Hi all!
I want to get a random integer between 0 and 7 and I’ve used the following:
Math.round(Math.random()*7)
The thing is that I want some numbers to appear more times than others.
Let’s say that I have a loop that runs 100 times. I want:
0 appear 28 times
1 appear 28 times
2 appear 19 times
3 appear 14 times
4 appear 6 times
5 appear 3 times
6 appear 1 times
7 appear 1 times
How is this possible?
Thanks