Skip to content

Latest commit

Β 

History

History
106 lines (73 loc) Β· 2.16 KB

File metadata and controls

106 lines (73 loc) Β· 2.16 KB

πŸŒ€ PyRand

Rust-powered random generation for Python Blazing-fast RNG utilities with parallel computation and distribution support. βš‘πŸπŸ’¨


πŸš€ Features

  • 🎲 Generate random integers, floats, and arrays
  • πŸ”€ Shuffle lists or sample subsets
  • ⚑ Parallelized operations with Rayon
  • 🧩 Multiple distributions: uniform, normal, etc.
  • πŸ”§ Fully compatible with Python 3.13+ and PyO3 forward-compatibility
  • ℹ️ Is fully typed.

πŸ’Ώ Installation

# From dist/ folder
python -m pip install dist\pyrand-x.x.x-cp3xx-cp3xx-win_amd64.whl --force-reinstall

Or build from source:

.\build.ps1

πŸ“ Example Usage

import pyrand

# Seed RNG
pyrand.set_seed(42)

# Single random number
x = pyrand.randfloat()
print("Random float:", x)

# Random integer
y = pyrand.randint(1, 100)
print("Random int:", y)

# Random array
arr = pyrand.rand_array(5, 1.0, 10.0)
print("Random array:", arr)

# Shuffle list
lst = [1, 2, 3, 4, 5]
pyrand.shuffle(lst)
print("Shuffled:", lst)

πŸ“¦ Available Functions

Function Description
set_seed(seed) Set RNG seed for reproducibility
randfloat() Random float [0, 1)
randint(a, b) Random integer between a and b
rand_array(n, low, high) Generate array of n random floats
uniform(low, high) Single uniform random float
choice(seq) Pick a random element
sample(seq, k) Random sample of k elements
shuffle(seq) Shuffle in-place

πŸ—οΈ Requirements

  • Python 3.10+
  • Rust toolchain
  • Maturin
  • PyO3

πŸ”§ Build & Development

.\build.ps1
  • Wheel gets copied to dist/
  • Installed automatically to your current Python

πŸ’‘ Notes

  • Parallel random generation is backed by Rayon
  • Designed to replace slow Python loops in heavy random computations

βš–οΈ License

MIT Β© Soumalya Das