On this page
  1. os.urandom
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

os.urandom

Prev: os.unlink | Up: os | Next: os.waitid_result
Rel: os.abort, os.access, os.chdir, os.chmod
Ref: docs.python.org — os.urandom
Tags: #public #python3 #stdlib #os


Import

import os
from os import urandom

Signature & Overview

os.urandom(size, /)

Return a bytes object containing random bytes suitable for cryptographic use.

Usage

import os

raw = os.urandom(16)
assert isinstance(raw, bytes) and len(raw) == 16

Gotchas

REPL Inspect

from os import urandom
help(urandom)

Linked from

Related notes