Discuss Scratch

lgrov44
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

I'll assume not because if I encode what Scratch thinks has a 50% chance of happening, the difference between the appearence of one than the other is slight but exists, with this value being about 0.033% and favouring the second option, but does this mean it is pseudo-random or is it too slight?

Last edited by lgrov44 (Jan. 14, 2024 06:31:09)


lgrov44, an Australian Scratcher whose most famous for his follows, followed by his activity, especially on Discussion Forums, and his follower count. Is also a remix chainer and school student. Identifies as bisexual.

My top 3 favourite people:
1. @Higgies (deleted) - First Follower, Thank you so much! (Wish you could see this…)
2. @Dubstepv1 (Banned/Moved) - Remix Chainer
3. @GIitchInTheMatrix (Moved to @GlitchedThrough) - Many small things.
Still looking for one of my first followers who are still active.
Vaibhs11
Scratcher
1000+ posts

Is Scratch's "randomness" blocks actually random?

This should probably be in AT.
TheUltimateHoodie
Scratcher
1000+ posts

Is Scratch's "randomness" blocks actually random?

lgrov44 wrote:

I'll assume not because if I encode what Scratch thinks has a 50% chance of happening, the difference between the appearence of one than the other is slight but exists, with this value being about 0.033% and favouring the second option, but does this mean it is pseudo-random or is it too slight?
maybe they are, maybe they aren't

can somebody give me something to put in my signature
floppasyay
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

I think they use psuedo random numbers with my knowledge of Game Builder Garage, I don't think anything is truly random in computer programs.

Last edited by floppasyay (Jan. 14, 2024 11:05:50)


lo siento si mi grámatica no es buena - aún aprendo | I have tasted mutated kumquats in the Philippines | Want cœl forum emojis? Click here!|


(born in UK but 100% Filipino)
IF YOU USE A NON-PERMANENT WASHABLE MARKER THE SCRATCH TEAM'S EVIL KUMQUATS WILL EAT UP YOUR SIGNATURE.
Aprendo español y tagalo.
Main languages (to learn): Spanish (español), Tagalog (my parent's mother tongue (they speak English as well))
SIGNATURE IN CONSTRUCTION
tnix100
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

Scratch uses Math.random in JavaScript to generate random numbers for ‘pick random () to ()’, this is probably the same for other blocks within Scratch. Math.random in JavaScript is pseudo random.

https://github.com/scratchfoundation/scratch-vm/blob/develop/src/blocks/scratch3_operators.js#L80-L91
Vaibhs11
Scratcher
1000+ posts

Is Scratch's "randomness" blocks actually random?

tnix100 wrote:

Scratch uses Math.random in JavaScript to generate random numbers for ‘pick random () to ()’, this is probably the same for other blocks within Scratch. Math.random in JavaScript is pseudo random.
Good thing I made this:
let num=100,t,z0,z1,i,a=0,b=0,p=[];for(i=0;i<num;i++){p[i]=Math.round(Math.random());}p.forEach(function(x){if(x){a++}else{b++}});t=a+b;z1=a*100/t;z0=b*100/t;console.log('0: '+z0+'%\n1: '+z1+'%');
5 runs on it [num = 10000] say:
0: 49.98%
1: 50.02%

0: 50.85%
1: 49.15%

0: 50.73%
1: 49.27%

0: 50.62%
1: 49.38%

0: 49.26%
1: 50.74%

Last edited by Vaibhs11 (Jan. 14, 2024 13:01:10)

Maximouse
Scratcher
1000+ posts

Is Scratch's "randomness" blocks actually random?

floppasyay wrote:

I think they use psuedo random numbers with my knowledge of Game Builder Garage, I don't think anything is truly random in computer programs.
Computers can generate truly random numbers – they're used in cryptographic algorithms.


This is Maximouse's signature. Learn more about signatures.
floppasyay
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

Maximouse wrote:

floppasyay wrote:

I think they use psuedo random numbers with my knowledge of Game Builder Garage, I don't think anything is truly random in computer programs.
Computers can generate truly random numbers – they're used in cryptographic algorithms.
Oh yeah sorry - I don't know my facts

Last edited by floppasyay (Jan. 14, 2024 14:43:24)


lo siento si mi grámatica no es buena - aún aprendo | I have tasted mutated kumquats in the Philippines | Want cœl forum emojis? Click here!|


(born in UK but 100% Filipino)
IF YOU USE A NON-PERMANENT WASHABLE MARKER THE SCRATCH TEAM'S EVIL KUMQUATS WILL EAT UP YOUR SIGNATURE.
Aprendo español y tagalo.
Main languages (to learn): Spanish (español), Tagalog (my parent's mother tongue (they speak English as well))
SIGNATURE IN CONSTRUCTION
lgrov44
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

floppasyay wrote:

Maximouse wrote:

floppasyay wrote:

I think they use psuedo random numbers with my knowledge of Game Builder Garage, I don't think anything is truly random in computer programs.
Computers can generate truly random numbers – they're used in cryptographic algorithms.
Oh yeah sorry - I don't know my facts
You're not entirely wrong though, it is still difficult to generate truely random numbers in most computer programs as computers normally follow a specific list of instructions, for example, viewing the exact site you are viewing to read this post. If you were to code it to generate random numbers then it must not be based on such instructions as they are often precise and clear, or at least to the computer.

lgrov44, an Australian Scratcher whose most famous for his follows, followed by his activity, especially on Discussion Forums, and his follower count. Is also a remix chainer and school student. Identifies as bisexual.

My top 3 favourite people:
1. @Higgies (deleted) - First Follower, Thank you so much! (Wish you could see this…)
2. @Dubstepv1 (Banned/Moved) - Remix Chainer
3. @GIitchInTheMatrix (Moved to @GlitchedThrough) - Many small things.
Still looking for one of my first followers who are still active.
lgrov44
Scratcher
500+ posts

Is Scratch's "randomness" blocks actually random?

BUMP After rediscovering this page XD

lgrov44, an Australian Scratcher whose most famous for his follows, followed by his activity, especially on Discussion Forums, and his follower count. Is also a remix chainer and school student. Identifies as bisexual.

My top 3 favourite people:
1. @Higgies (deleted) - First Follower, Thank you so much! (Wish you could see this…)
2. @Dubstepv1 (Banned/Moved) - Remix Chainer
3. @GIitchInTheMatrix (Moved to @GlitchedThrough) - Many small things.
Still looking for one of my first followers who are still active.
TheUltimateHoodie
Scratcher
1000+ posts

Is Scratch's "randomness" blocks actually random?

floppasyay wrote:

Maximouse wrote:

floppasyay wrote:

I think they use psuedo random numbers with my knowledge of Game Builder Garage, I don't think anything is truly random in computer programs.
Computers can generate truly random numbers – they're used in cryptographic algorithms.
Oh yeah sorry - I don't know my facts
Scratch uses only software to come up with seemingly random numbers. All numbers can be predicted.

can somebody give me something to put in my signature

Powered by DjangoBB