Stormworks: Build and Rescue

Stormworks: Build and Rescue

Nincs elegendő értékelés
Random Number Generator
   
Díjazás
Kedvenc
Kedvenc
Törlés
Vehicles: Air, Sea, Creative, Land
Címkék: v1.0.26
Fájlméret:
Közzétéve:
443.245 KB
2020. dec. 23., 14:48
1 változásjegyzék ( megnézés )

Feliratkozás a letöltéshez
Random Number Generator

2 katstel készítette gyűjteményben
kat's microprocessors
24 elem
katstel
52 elem
Leírás
Random Number Generator
How to use
This is a microprocessor that generates a random number between 1 and 100 (or within a set bound) at the press of a button. It is very easy to set up. Simply connect a push button to the main input. Each time you press this button, a new random number will be drawn from the system into the numerical output. The threshold of numbers generated can be selected in the property menu with the sliders of minimum and maximum value.
=> NOTE: when selecting the minimum and maximum threshold, do not put the min threshold larger than the max threshold. It will not work properly and a tooltip warning will appear on the microcontroller.
=> NOTE: only use a push input or it will not function properly

How does it work?
There are a series of PID controllers continuously oscillating between a set positive and negative value, and a function which gets the ”average” across all these controllers. By isolating the string of decimal values we get a very precise number which is continuously changing so quickly it is perceived to be random. Whenever the user presses the “Retrieve number” button, it pulls a number (which number is multiplied from the “random” string of decimal values and rounded to form an integer) and puts it through a memory register to save it in the system.
Because there are multiple PID controllers running at once, the “random” value constantly cycles up and down randomly between 0.01 and 9.99 so there isn’t exactly a “pattern” or “cycle” to it. This adds an extra factor of randomness to the system. However as an extra “failsafe” to ensure maximum randomness there is a very very short timer on the input, which does not permit a value to be sent through as long as the user is still pressing the button. This allows only one value to be sent on each input.

Probabilities
Now, that being said, there is a slightly higher probability you will receive certain numbers compared to others. While it is still possible, you are slightly less likely to get the exact value of the minimum or maximum bound itself because these can only be rounded one way to be output, contrary to the rest of the values which can be output by rounding up or down. From a non-mathematical/statistical point of view it is as random as random can get, and that’s all you need to worry about. It is actually possible to receive every single whole number between 1 and 100 and i have tested this to be true. So please don’t come to me and fuss about how some numbers don’t appear. It’s random and will not be the same every time.

Fair Use
Please give credit when used on your creations. Thanks
9 megjegyzés
katstel  [készítő] 2021. aug. 9., 16:59 
@aladdinno YT
I have thoroughly tested it prior to posting, so if it doesn't work then there is mostly likely a update /glitch in the game that broke it. I will re-test it and see if I can find any fault on latest version of the game.
Aladdinno 2021. aug. 9., 6:47 
it doesnt works
TheSavageProdigy 2021. febr. 6., 19:09 
How do people like you get unnoticed when you make things like this holy crap.
katstel  [készítő] 2021. jan. 25., 15:48 
im not good with lua, and i dont know if these commands are compatible with the stormworks API. I looked into that and figured it would be easier to do this than figure out a lua solution for it.
Yan Kerschen 2021. jan. 23., 11:35 
good work but next time use math.random in lua
thatcoolcat1 2020. dec. 26., 7:34 
good work :steamthumbsup:
katstel  [készítő] 2020. dec. 25., 11:49 
thx ^^
Orca 2020. dec. 24., 18:27 
nice
sundermann99 2020. dec. 23., 18:44 
ahh haa, finnaly