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

#1 2012-03-28 06:30:42

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Randomization algorithms

Since computers cannot generate truely random numbers, they use a cleverly designed algorithm that is unpredictable.

The variable X must be the index of the value if your algorithm generates periodic random numbers.
NOTE: Algorithms 1-4 are made using online applets.
I have two algorithms that uses one variable named X. Notice both values are less random with an X of above -3.34 and below 3.34.
1. y = abs(cos(tan(cos(x*pi)*sin(x/pi)*(x+(x*x))/(pi*(4.149683-(pi*2)))*0.9489832928)))
2. y = abs(atan(asin(cos(sin(x/pi)/cos(x*pi)/(pi/x)))))

I created another (infact, 2 more) simpler algorithms that are more random but require X to be positive.
3. y = abs(sin(x^x))
4. y = abs(cos(x^x))

Last edited by rdococ (2012-03-28 07:38:18)

Offline

 

#2 2012-03-28 07:16:59

Laternenpfahl
Scratcher
Registered: 2011-06-24
Posts: 1000+

Re: Randomization algorithms

What?

You lost me there.


http://i46.tinypic.com/6yd4c0.png

Offline

 

#3 2012-03-28 07:25:10

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Offline

 

#4 2012-03-28 07:33:10

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: Randomization algorithms

rdococ wrote:

3. y = abs(sin(x^x))
4. y = abs(cos(x^x))

Those aren't random  tongue
Yes, I've tested then  tongue


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#5 2012-03-28 07:36:33

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Randomization algorithms

slinger wrote:

rdococ wrote:

3. y = abs(sin(x^x))
4. y = abs(cos(x^x))

Those aren't random  tongue
Yes, I've tested then  tongue

...maybe because you kept incrementing X by 1 instead of incrementing X by some low value (e.g. 0.1415926535...)?

Offline

 

#6 2012-03-28 08:08:21

slinger
Scratcher
Registered: 2011-06-21
Posts: 1000+

Re: Randomization algorithms

Ok, whatever  tongue
Here is how computers do random  tongue

x = 1
wait
x = 2
wait
x = 3
wait
x = 4
etc  tongue

I may be wrong but that's how you used to do it  tongue


http://s0.bcbits.com/img/buttons/bandcamp_130x27_blue.png

Offline

 

#7 2012-03-28 08:14:57

lukanater
Scratcher
Registered: 2007-09-26
Posts: 100+

Re: Randomization algorithms

rdococ wrote:

slinger wrote:

rdococ wrote:

3. y = abs(sin(x^x))
4. y = abs(cos(x^x))

Those aren't random  tongue
Yes, I've tested then  tongue

...maybe because you kept incrementing X by 1 instead of incrementing X by some low value (e.g. 0.1415926535...)?

If you do that they aren't random either.  They just give the illusion of being random don't they?


http://i1049.photobucket.com/albums/s385/xenokstudios/trippinstudios.png

Offline

 

#8 2012-03-28 18:09:41

witchartix
Scratcher
Registered: 2011-07-27
Posts: 100+

Re: Randomization algorithms

Is this highschool math and beyond? I'm kinda lost here.


Choo! Choo! All aboard the Moron Express!

Offline

 

#9 2012-03-28 19:54:24

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: Randomization algorithms

Hmm...
Nice.
I might use one of those.


http://trinary.tk/images/signature_.php

Offline

 

Board footer