jeudi 23 juillet 2020

Why can I use the random.radint method without instantiating an instance?

To use the random.randint method I can use the following two options:

import random

# one way to use random
random.randint(1,10)

# second way with instanciating first
instance = random.Random()
instance.randint(1,10)

Why can I use the first way although I did not instantiate an instance yet?




Aucun commentaire:

Enregistrer un commentaire