Random Number Generator

Random Number Generator

zazencodes

Generates random numbers, shuffles lists, and creates secure tokens using Python's standard library functions. Includes both pseudorandom and cryptographically secure operations.

46291 views7Local (stdio)

What it does

  • Generate random integers and floats within specified ranges
  • Shuffle lists and sample items with or without replacement
  • Create weighted random selections from populations
  • Generate cryptographically secure hex tokens
  • Produce secure random integers for authentication

Best for

Developers needing randomization in applicationsTesting and simulation scenariosSecurity token generationGame development and lottery systems
Both pseudorandom and cryptographically secure optionsNo external dependencies or API keys required

Tools (7)

random_int

Generate a random integer between low and high (inclusive). Args: low: Lower bound (inclusive) high: Upper bound (inclusive) Returns: Random integer between low and high

random_float

Generate a random float between low and high. Args: low: Lower bound (default 0.0) high: Upper bound (default 1.0) Returns: Random float between low and high

random_choices

Choose k items from population with replacement, optionally weighted. Args: population: List of items to choose from k: Number of items to choose (default 1) weights: Optional weights for each item (default None for equal weights) Returns: List of k chosen items

random_shuffle

Return a new list with items in random order. Args: items: List of items to shuffle Returns: New list with items in random order

random_sample

Choose k unique items from population without replacement. Args: population: List of items to choose from k: Number of items to choose Returns: List of k unique chosen items

Alternatives