mardi 9 janvier 2018

Psuedo-random generation: is this more or less random?

I'm curious about how this works out mathematically, but I'm not smart enough to figure it out myself. (I tried)

If you generate a list of 1000 psuedo-random numbers, such as:

random_numbers = []
for i in range(1,1000):
    random_numbers.append(random.randrange(1000,9999))

Then generate another psuedo-random number to use as an index for the list:

final_value = random_numbers[rand.randrange(1,1000)]

Intuitively, this seems like it would be more random than simply generating 1 psuedo-random value like this:

number = random.randrage(1000,9999)

However, I know there's often a lot of gotchas with randomness so I figured I'd ask you guys.




Aucun commentaire:

Enregistrer un commentaire