Well, I had my doubts about randint() so I decided to test it out. I whipped up a little code in order to do so.
from random import randint
from console import clear
zero = one = two = three = 0
ergo = 0
clean = 0
while ergo < 1000000:
#Randomly choses 0,1,2,or3
spin = randint(0,3)
#Keeps track of how often a given number comes up
if spin == 0:
zero += 1
elif spin ==1:
one += 1
elif spin == 2:
two += 1
elif spin == 3:
three += 1
ergo += 1
clean +=1
#This prints what number ergo is at, in thousands
if clean == 1000:
clean = 0
clear()
print (ergo)
#Converts the tallies into percentages and then prints the results
y=0
rolls = [zero, one, two, three]
names = ["zero","one","two","three"]
for x in rolls:
spam = (x/1000000.0)*100
print (names[y]+":"+str(spam)+"%")
y += 1
To explain what this program does, it randomly choses one of four numbers (zero, one, two, or three). It then keeps a tally of which number it choses. It proceeds to do this a total of one million times!
After the computation is complete, it turns the tallies into percentages and prints the results. Because there are four numbers, each number should appear 25% of the time. Here is the results from my most recent running:
1000000 zero:25.0265% one:24.9848% two:24.9903% three:24.9984%
As you can see, each number appears (almost) 25% of the time. I'd say that randint() works pretty well.
Just a word to the wise, the program takes some time to run. Somewhere between five and ten minutes.
Cubbarooney