I mean, if you think about it, a computer only does what it's told to, so will be unable to do anything unexpected. So does this mean the 'Pick random # to #' block isn't COMPLETELY random? I can't really see how it can...
Offline
Without looking at the source code to Scratch, I'll take a guess and say they are using the Linear Congruential Method of selecting random sequences.
http://en.wikipedia.org/wiki/Linear_con … _generator
Enjoy.
Offline
You're telling it to get a random number within a range, it's not 100% random.
Offline
BoltBait wrote:
Without looking at the source code to Scratch, I'll take a guess and say they are using the Linear Congruential Method of selecting random sequences.
http://en.wikipedia.org/wiki/Linear_con … _generator
Enjoy.
Thanks for replying, but I don't really understand anything Wikipedia says about maths!
Offline
Scratch indeed uses a pseudo-random number generator, based on the run time of the VM (how long Scratch has been running for).
It seeds the milliseconds from the run time to obtain the number you asked for in your 'pick random' block. It is not truly random, and the sequence will eventually repeat, but no project will ever run long enough to reach the 4 294 967 296 repetitions! (that's 2^32)
To get a truly random factor you would need to use something physical such as the temperature (which, again, does not vary much) or something else from the exterior.
That was explained in really basic terms and, as a consequence, not very appropriate vocabulary. I could slightly expand on that but I don't think there's the need, and if you really do want to know more there's always that wikipedia page on PRNG's
Last edited by LS97 (2011-12-02 16:00:17)
Offline
LS97 wrote:
Scratch indeed uses a pseudo-random number generator, based on the run time of the VM (how long Scratch has been running for).
It seeds the milliseconds from the run time to obtain the number you asked for in your 'pick random' block. It is not truly random, and the sequence will eventually repeat, but no project will ever run long enough to reach the 4 294 967 296 repetitions!(that's 2^32)
To get a truly random factor you would need to use something physical such as the temperature (which, again, does not vary much) or something else from the exterior.
That was explained in really basic terms and, as a consequence, not very appropriate vocabulary. I could slightly expand on that but I don't think there's the need, and if you really do want to know more there's always that wikipedia page on PRNG's![]()
Thanks a lot, this was the best answer by far.
Offline