In the docs for Python's random
, it states that one can "use a basic generator of your own" by overriding the random()
method. Suppose I have a custom generator that outputs a random float uniformly in the semi-open range [0.0, 1.0), i.e. just like random()
.
- How would I go about replacing Python's with my own?
Further, suppose the replacement is a true random generator built off of a natural source of entropy.
- Does this mean I can use the other parts of the class like
random.choice()
on a given array and make claims that the chosen element is truly random?
Aucun commentaire:
Enregistrer un commentaire