Stormworks: Build and Rescue

Stormworks: Build and Rescue

Onvoldoende beoordelingen
Random Number Generator
   
Prijs
Toevoegen aan favorieten
Toegevoegd aan favorieten
Verwijderen uit favorieten
Vehicles: Air, Sea, Creative, Land
Tags: v1.0.26
Bestandsgrootte
Geplaatst op
443.245 KB
23 dec 2020 om 14:48
1 wijzigingsnotitie (weergeven)

Abonneren om te downloaden
Random Number Generator

In 2 verzamelingen van katstel
kat's microprocessors
24 items
katstel
52 items
Omschrijving
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 opmerkingen
katstel  [auteur] 9 aug 2021 om 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 9 aug 2021 om 6:47 
it doesnt works
TheSavageProdigy 6 feb 2021 om 19:09 
How do people like you get unnoticed when you make things like this holy crap.
katstel  [auteur] 25 jan 2021 om 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 23 jan 2021 om 11:35 
good work but next time use math.random in lua
thatcoolcat1 26 dec 2020 om 7:34 
good work :steamthumbsup:
katstel  [auteur] 25 dec 2020 om 11:49 
thx ^^
Orca 24 dec 2020 om 18:27 
nice
sundermann99 23 dec 2020 om 18:44 
ahh haa, finnaly