On this page
  1. random.SystemRandom
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

random.SystemRandom

Prev: random.shuffle | Up: random | Next: random.triangular
Rel: random.betavariate, random.binomialvariate, random.choice, random.choices
Ref: docs.python.org — random.SystemRandom
Tags: #public #python3 #stdlib #random


Import

import random
from random import SystemRandom

Signature & Overview

random.SystemRandom(x=None)

Alternate random number generator using sources provided by the operating system (such as /dev/urandom on Unix or CryptGenRandom on Windows).

Methods & Attributes

Usage

import random

rng = random.SystemRandom()
val = rng.randrange(1, 100)
assert 1 <= val < 100

Gotchas

REPL Inspect

from random import SystemRandom
help(SystemRandom)

Linked from

Related notes