Discuss Scratch

ideapad-320
Scratcher
1000+ posts

Pich random block is not very random.

My browser / operating system: Windows NT 10.0, Chrome 66.0.3359.181, Flash 30.0 (release 0)
try running
(pick random (1) to (2))
see? 1 is picked more often

Last edited by ideapad-320 (June 12, 2018 19:32:21)


This is my siggy.
Can't wait for FRC water game!
LionHeart70
Scratcher
1000+ posts

Pich random block is not very random.

Probably not a glitch. When faced with very small intervals like that, you often get it to pick one more than the other.
If it were picking something like 1, 2, 1, 2, then that wouldn't be very random either since that's in a pattern.

lh70 / nora/tobi / she-they pronouns / pansexual-demisexual / 14 / sagittarius / furry / artist / intp / stop-motion films / lbp / fall out boy / panic! at the disco / twenty one pilots / stranger things / a series of unfortunate events
“When you have a bad day, a really bad day, try and treat the world better than it treated you.” -Patrick Stump
“Music seems to hold everything together. It seems to make things not so chaotic sometimes. It seems to make things make more sense sometimes.” -Tyler Joseph
“You'll fear your fears forever if you never do things you're afraid of.” -Josh Dun
“I'm still figuring out who I am, but I know I'm not who I was.” -Brendon Urie
CeruleanRose
Scratcher
100+ posts

Pich random block is not very random.

It is just a coincidence. Try running it 500 times. You’ll see. Small intervals are easy to mix up. If you ran it 10 times, odds are it’s not exactly 5-5. It won’t be exact or it’ll be a pattern. (Unless it lands on the one in a million)

Stop :: #007FFF stack
global :: #03C03C stack
warming! :: #007FFF stack
'Sup.
 Hello there! Just a warning, I put a loooooot of text in this thing so only read it if you have time. I used the [code] tag to make this thingy. So... yeah! Hi there! I'm Isabella, but you can just call me Izzy. This is actually my second account, I'll follow you if you can follow the digital breadcrumbs and find my other. Scavenger hunt! Seriously tho I just wanted a disconnected account so if you can find it you get a digital thumbs-up. Currently, I am into (don't close out on me here!) the video game Undertale. If you haven't heard of it, it's "The video game where nothing has to die." It's got one of my favorite stories and-    well, I won't rant at you here. Don't be put off by the toxic fanbase, most of us find the small but vocal group of 10-year-olds quite obnoxious as well. Also, I'm trying to improve my art although I haven't put much of it on this account. I don't like the 3.0 costume maker interface tho because they ruined the reshape tool and now it considers a line a donut-shaped object and I used to do most of my art through reshaping basic shapes so yeah. I've recently gotten into a few art YouTubers who are my current senpais, look up WalkingMelonsAAA. I hope to draw like her someday. lol, I had this whole idea for what I was going to put in my siggy and I got waaaaay off track. It's also too long so I'll cut out some of what I was going to say. Do you have any tips on making my poses not so stiff? I know this is a problem loads of young artists have had. This account is currently most active on the forums so I most likely won't make any new projects here for a while. And this tells me you read to the end and care about what I have to say! Here's a heart. ♥ Leave a comment on my Week 4 Leilani's Art Camp project with the phrase "caramel popcorn" and I'll love one of your projects. Thanks for reading this! Bye! 
ideapad-320
Scratcher
1000+ posts

Pich random block is not very random.

I ran it a bunch. it seems to happen only at the beginning

This is my siggy.
Can't wait for FRC water game!
-ShadowOfTheFuture-
Scratcher
1000+ posts

Pich random block is not very random.

I mean, if you run it very few times, one will almost certainly be picked a lot more than the other (if you ran it 2 times only, there's a 1/2 chance that both times will be the same number). But if you run it, say, 5000 times, or 10000 times, overall it'll likely come out to be around even.

But then again, the pick random block only uses “pseudo-randomness”, but I doubt that would have much of an impact on how random it seems.

<Insert uncreative signature here>









██       ██  ██            ██  ██       ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████

“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
Flowermanvista
Scratcher
1000+ posts

Pich random block is not very random.

Just to add to this, the “pick random” block uses a pseudo-random algorithm, which isn't really true randomness, but in most cases, such as Scratch projects, it is close enough to true randomness that it isn't really a problem. I threw together a quick experiment and I tested 10,000,000 iterations of picking randomly from 1 or 2. I zoomed in on a small section of the graph, and it seems to have a slight preference for twos over ones, but the difference is small enough (less than 0.1%) that it would not be a problem for casual uses.



I decided to do a second test, using numbers 1 to 10. As expected, there was some deviation from the expected 1,000,000 for each, but no significant biases. Again, it's very close - close enough that in almost all cases, it would be good enough.



In both cases, if it was zoomed out, it would look like all bars were the same height.

In conclusion, it seems to be, for the most part, a fairly good pseudo-random number generator.

Last edited by Flowermanvista (June 13, 2018 22:11:31)


Add a SPOOKY SKELETON to your project!

The Scratch 3 Project Save Troubleshooter - find out why your project won't save

ST, Please Add A Warning When A Size Limit Is Exceeded

My Dumb Creations - THE BEST ANIMATION | The Windows 98 Experience (made on Windows 98) | nobody cares about Me… | the2000 Reveals His New Profile Picture | Not Dumb Creations - Ten Years
Ctrl+Shift+Down for more…
Do evil kumquats keep eating your signature? Assert your dominance and eat the evil kumquats. Did you know that kumquats are only about the size of an olive?

Powered by DjangoBB