circuitpython/tests/cpydiff/modules_random_randint.py
Damien George ab2923dfa1 all: Update Python formatting to latest Black version 22.1.0.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-02 16:49:55 +11:00

13 lines
460 B
Python

"""
categories: Modules,random
description: ``randint`` method can only return an integer that is at most the native word size.
cause: PRNG is only able to generate 32 bits of state at a time. The result is then cast into a native sized int instead of a full int object.
workaround: If you need integers larger than native wordsize use the random module from micropython-lib.
"""
import random
x = random.randint(2**128 - 1, 2**128)
print("x={}".format(x))