Pages: 1
Topic closed
Just curious.
Offline
This would be interesting as visual basic (well microsofts visual basic) are the same random numbers every time on every computer that runs it.
Offline
I believe it uses some sort of algorithm, but I'm not sure what that algorithm is...
Offline
One of the hardest things for people to program is a random number picker. It's usually done by creating a list, dividing, rounding, etc.. Another method is messing around with the time... what does Scratch use?
At least we should be glad that we have the random block.
Offline
It uses a variable gate dynamic oscillator that syncs the cpu load at a given moment with the speed fluctuation of a virtual cd-rom burning a bit-reduced copy of Judas Priest's Rocka Rolla. Then it multiplies (or divides) the result (and does abs if necessary) to derive the sweep range.
Offline
Locomule wrote:
It uses a variable gate dynamic oscillator that syncs the cpu load at a given moment with the speed fluctuation of a virtual cd-rom burning a bit-reduced copy of Judas Priest's Rocka Rolla. Then it multiplies (or divides) the result (and does abs if necessary) to derive the sweep range.
Thanks!
Offline
Without looking into the Scratch source code, but knowing a bit about computer generated random numbers (pseudo-random numbers), I would bet that Scratch uses a Linear Congruential random number generator.
More info here: http://en.wikipedia.org/wiki/Linear_congruential_generator
It is extremely fast, and if the coefficients c, m, and a are chosen properly it has a very large period and a very good distribution.
Offline
fg123 wrote:
Maybe it uses the id number of the program and does some random calculations to make it equal * , then it has 1 second to run through the numbers you listed and stop at the * number??
That's not possible, because to make a random calculation it would have to use itself to generate the numbers for the calculation, but it couldn't. Do you see what I mean?
Offline
Topic closed
Pages: 1