hbutils.random

Overview:

Random utilities module providing various random value generators.

This module contains utilities for generating random sequences, binary data, strings, and managing random state. It serves as a central import point for all random-related functionality in the hbutils package.

The module includes:

  • Binary random data generation

  • Sequence generation utilities

  • Random state management

  • String generation utilities

Example::
>>> from hbutils.random import random_bytes, random_shuffle, keep_global_state
>>> # Generate random bytes
>>> data = random_bytes(16)
>>> # Shuffle a sequence
>>> items = [1, 2, 3, 4, 5]
>>> shuffled = random_shuffle(items)
>>> # Manage random state
>>> with keep_global_state():
...     # Random operations here will not affect global state
...     pass