Is Random in programming similar to real "Random" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is Random in programming similar to real "Random"

I made a game where you roll a die and it will tell you how many rolls it took to reach over 1000. Most of the results are in the same range (250-300, 6 sided die). Would I receive similar results if I were to actually repeatedly roll a die for 1000 points? https://code.sololearn.com/cYmFkZpIg7MB/?ref=app

26th Jan 2020, 6:19 AM
iDontCodeEnough
iDontCodeEnough - avatar
2 Answers
+ 2
I think so. Besides, maybe ... if you were to do it with hand, and you hold the dice on the same side everytime, and roll it at the same pressure and direction everytime, that might change a little. But, for the most part, I think it would be the same.
26th Jan 2020, 6:30 AM
Ginfio
Ginfio - avatar
+ 2
1000 / avg_dice_value avg_dice_value = (1+2+3+4+5+6)/6 = 3.5 1000/3.5 ~ 286 The amount of random throws would likely be close to 286.
26th Jan 2020, 7:06 AM
Seb TheS
Seb TheS - avatar