How can I generate a random number in Scratch. The
( pick random 1 to 10 )
uses the timer so its not perfectly random, so whats the way I can get a more random number than that, using Scratch 1.4!
Offline
Maybe you could try adding another factor to it.
Offline
so like
( ( pick random ( pick random ( ( abs | timer |) * 10 ) to 2500 ) ) to ( 3000 ) * ( pick random 1 to 10 ) )
Last edited by johnnydean1 (2010-08-30 10:51:54)
Offline
johnnydean1 wrote:
How can I generate a random number in Scratch. The
( pick random 1 to 10 )
uses the timer so its not perfectly random, so whats the way I can get a more random number than that, using Scratch 1.4!
No, the (pick random) uses the timer's millisecond value as a SEED.
Offline
nXIII wrote:
johnnydean1 wrote:
How can I generate a random number in Scratch. The
( pick random 1 to 10 )
uses the timer so its not perfectly random, so whats the way I can get a more random number than that, using Scratch 1.4!No, the (pick random) uses the timer's millisecond value as a SEED.
which is pretty different in fact. see this wikipedia article
Offline
LS97 wrote:
nXIII wrote:
johnnydean1 wrote:
How can I generate a random number in Scratch. The
( pick random 1 to 10 )
uses the timer so its not perfectly random, so whats the way I can get a more random number than that, using Scratch 1.4!No, the (pick random) uses the timer's millisecond value as a SEED.
which is pretty different in fact. see this wikipedia article
I know what a seed is >.>
Offline
not ou, nxiii, but JD1.
you obviously do or you wouldn't have posted that.
besides, you normally know what you're talking about
Offline
Ahhh, I know but when I do generate 1 - 10 (in a random block) I always seem to get a number lower than 6 90% of the time!
Offline
i get it perfectly equal.
Offline
You could make a project to find out.
Offline
johnnydean1 wrote:
How can I generate a random number in Scratch. The
( pick random 1 to 10 )
uses the timer so its not perfectly random, so whats the way I can get a more random number than that, using Scratch 1.4!
I'm interested. How does it use the timer?
Offline
^^ it gets the current milliseconds and uses that number as a seed for your random numbers. SO, that can vary. it's almost completely random. but on some slow computers that doen't work as well and you get weird results.
Offline
like me. Although my laptop is like 6 months old as is like the most powerful I could find!
Offline
mine's a pretty good one too, although it's not as new
---------I-----------
-------hate-------
--the 60s rule--
Offline
^^why would that be so random?
it would be exactly the same as taking any other number
Offline
I ran an experiment a while back that added random numbers from 0 to 200 or so to a list. If the random number selected by Scratch had already been chosen (i.e was already in the list) it would not be added but would increment a "repeats" variable by one. I noticed that only as it neared 200 did the chance of a repeat increase to more than one every 20 or so. I did this test quite a while ago so I can't remember the exact results but Scratch seemed almost to be choosing random numbers it had not yet chosen over ones it had...
I don't believe there is any such thing as truly random, either in computers or in the natural world. Things that appear random to us are merely reached after a series of events too vast and incalulable to be guessed, and therefore appear and serve us well as "random" outcomes.
Offline
I have a project which visually shows the random numbers in a graph.
http://scratch.mit.edu/projects/what-the/1256383
Not random enough for my liking
My site Offline