Método aleatorio getrandbits() de Python
Ejemplo
Devuelve un entero de tamaño de 8 bits:
import random
print(random.getrandbits(8))
Definición y uso
El getrandbits()
método devuelve un número entero del tamaño especificado (en bits).
Sintaxis
random.getrandbits(n)
Valores paramétricos
Parameter | Description |
---|---|
n | Required. A number specifying the size, in bits, of the returned integer. |