Python‎ > ‎random‎ > ‎

random.getrandbits()

http://www.adilwaseem.com/

Introduction
Generates an int with k random bits.

Syntax
getrandbits()-> x. 

Parameters
x=number

Examples
The return with the random number.
import random
x=random.getrandbits(33)

>>> 
4063207785
>>> 

The method return with the sample random from the random methods.
import random
a=[random.weibullvariate(1,4),random.choice([1,3,5,7]),random.getrandbits(3)]
print(random.sample(a,1))

>>> 
[0.8132223906535521]
>>>


Comments