samedi 2 mars 2019

Problems with python random number generator. Is it really random?

Is the random number generator that is inside of the "random" module actually random?

I am trying to build a function that simulates a basketball game, using the random number generator to decide whether or not a team made a shot and what kind of shot they take. It works like this;

x = random.randint(1,1000) if x/1000 <= threePointPct: teamA += 3

The problem I'm running into is pretty much every team is shooting over 50% from three. The team with the highest three point % in the NBA as of today is .409. The average 3 point % is .35. I've simulated over 500 games now and it's hard for me to believe this is truly random. If anyone has any answers or knows a better module to use, feedback would be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire