This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-08-30 10:38:31

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

As random as it gets!

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!


You can now reach me on Twitter @johnnydean1_

Offline

 

#2 2010-08-30 10:48:14

Billybob-Mario
Scratcher
Registered: 2008-01-05
Posts: 500+

Re: As random as it gets!

Maybe you could try adding another factor to it.

Offline

 

#3 2010-08-30 10:50:58

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: As random as it gets!

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)


You can now reach me on Twitter @johnnydean1_

Offline

 

#4 2010-08-30 11:13:03

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: As random as it gets!

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.


nXIII

Offline

 

#5 2010-08-30 11:27:11

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

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

 

#6 2010-08-30 11:35:17

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: As random as it gets!

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 >.>


nXIII

Offline

 

#7 2010-08-30 11:36:54

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

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

 

#8 2010-08-30 11:40:50

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: As random as it gets!

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!


You can now reach me on Twitter @johnnydean1_

Offline

 

#9 2010-08-30 11:42:39

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

i get it perfectly equal.

Offline

 

#10 2010-08-30 11:52:02

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: As random as it gets!

You could make a project to find out.


/* No comment */

Offline

 

#11 2010-08-30 13:55:21

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: As random as it gets!

TheSuccessor wrote:

You could make a project to find out.

I did  tongue


nXIII

Offline

 

#12 2010-08-31 06:33:52

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: As random as it gets!

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?


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#13 2010-08-31 11:22:40

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

^^ 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

 

#14 2010-08-31 11:31:47

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: As random as it gets!

like me. Although my laptop is like 6 months old as is like the most powerful I could find!


You can now reach me on Twitter @johnnydean1_

Offline

 

#15 2010-08-31 11:37:19

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

mine's a pretty good one too, although it's not as new  big_smile
---------I-----------
-------hate-------
--the 60s rule--

Offline

 

#16 2010-08-31 20:26:51

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: As random as it gets!

If you want to code the random (  big_smile  )
make it do that and multiply by 11 then divide by 7.
That will be random!  big_smile


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#17 2010-09-01 12:21:59

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: As random as it gets!

^^why would that be so random?
it would be exactly the same as taking any other number

Offline

 

#18 2011-02-12 15:10:27

MeTwo
Scratcher
Registered: 2010-11-29
Posts: 14

Re: As random as it gets!

u can put a random block in a random in a random!  big_smile

Offline

 

#19 2011-02-13 14:43:14

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: As random as it gets!

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.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#20 2011-02-14 02:34:33

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: As random as it gets!

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


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

Board footer