196
TI-BASIC / Re: help me understand random seed.
« on: June 20, 2011, 11:20:24 am »
It's very important to realize that it's extremely hard to ever create a 'random' number in computers. Computers don't do random.
Instead, the next best alternative is creating 'pseudo-random' numbers -- numbers, that on the surface, seem random, but are actually determined by a complex formula.
The seed is the initial value that you are feeding the 'rand' function. The calculator (and all random-number-generators) takes the seed, and feeds it into a complex function that will output a pseudo-random number. It then takes that pseudo-random number and feeds it back into the rand function the next time it is called.
You can exploit this effect: if you constantly store the same seed, the output value will be identical each time.
tl;dr:
You can't do random numbers on computers, instead, you feed a function a seed number, and it transforms that seed into something that's random enough.
(And if I got anything wrong, or am unclear, feel free to point it out )
Instead, the next best alternative is creating 'pseudo-random' numbers -- numbers, that on the surface, seem random, but are actually determined by a complex formula.
The seed is the initial value that you are feeding the 'rand' function. The calculator (and all random-number-generators) takes the seed, and feeds it into a complex function that will output a pseudo-random number. It then takes that pseudo-random number and feeds it back into the rand function the next time it is called.
You can exploit this effect: if you constantly store the same seed, the output value will be identical each time.
tl;dr:
You can't do random numbers on computers, instead, you feed a function a seed number, and it transforms that seed into something that's random enough.
(And if I got anything wrong, or am unclear, feel free to point it out )