Omni RNG: A unified, cross-backend random number generator built on the Array API standard.
Project description
Omni RNG (orng)
orng provides a thin facade over several Array API–compatible random number
generators. It mirrors the subset of the numpy.random.Generator API:
randomuniformnormalchoicegamma
letting you pick the underlying backend at runtime. The following backends are currently supported:
numpytorchcupyjax
Installation
The core package only depends on the standard Python library:
pip install orng
Backends are optional extras that you can install on demand:
pip install "orng[numpy]" # NumPy RNG support
pip install "orng[torch]" # PyTorch RNG support
pip install "orng[cupy]" # CuPy RNG support
pip install "orng[jax]" # JAX RNG support
You can also combine extras, e.g. pip install "orng[numpy,torch]".
Quick Start
from orng import ArrayRNG
rng = ArrayRNG(backend="numpy", seed=42)
samples = rng.normal(loc=0.0, scale=1.0, size=5)
uniform = rng.uniform(low=-1.0, high=1.0, size=(2, 2))
The backend module is imported lazily. If the requested library is missing,
ArrayRNG will raise an informative ImportError that points to the matching
extra.
Backend State Reference
When you pass the optional generator argument to ArrayRNG, the expected
object depends on the backend:
| Backend | Generator argument |
|---|---|
numpy |
numpy.random.Generator |
torch |
torch.Generator |
cupy |
cupy.random.Generator |
jax |
jax.random.KeyArray (from jax.random.key) |
This lets you wrap an existing RNG/key instead of seeding a new one.
Project Layout
orng/
├── src/orng/
│ ├── __init__.py # package exports
│ ├── _utils.py # shared helpers (internal)
│ ├── orng.py # ArrayRNG facade
│ └── backends/ # backend-specific implementations
└── README.md
Each backend class lives in its own module under orng/backends/, keeping the
core facade compact and making optional dependencies easy to manage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orng-0.1.0a4.tar.gz.
File metadata
- Download URL: orng-0.1.0a4.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a92358cf01ee1def224952054d7a5e2a247ea958c5146970dfad90cae79e964
|
|
| MD5 |
2c67e95a17a697357d09b3974752a522
|
|
| BLAKE2b-256 |
56109e4a1115def2cf4d10299bf6afa194e71df29033857d56d07486297cd81e
|
Provenance
The following attestation bundles were made for orng-0.1.0a4.tar.gz:
Publisher:
publish.yml on sequince-dev/orng
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orng-0.1.0a4.tar.gz -
Subject digest:
3a92358cf01ee1def224952054d7a5e2a247ea958c5146970dfad90cae79e964 - Sigstore transparency entry: 749137479
- Sigstore integration time:
-
Permalink:
sequince-dev/orng@2dcfffc01a7a944ec1482e6898383cbb340c2972 -
Branch / Tag:
refs/tags/v0.1.0a4 - Owner: https://github.com/sequince-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2dcfffc01a7a944ec1482e6898383cbb340c2972 -
Trigger Event:
release
-
Statement type:
File details
Details for the file orng-0.1.0a4-py3-none-any.whl.
File metadata
- Download URL: orng-0.1.0a4-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5818f7cc2f6ecefb055b30b871667ab7177b9beb7f5f5bf27131f2b7d9bf7d7b
|
|
| MD5 |
35812057e79cb8be730edd79fb2d5c0b
|
|
| BLAKE2b-256 |
2825fbac1aa80ffc013e6399c8566943bf9df90e4851291890616c34ed3d8831
|
Provenance
The following attestation bundles were made for orng-0.1.0a4-py3-none-any.whl:
Publisher:
publish.yml on sequince-dev/orng
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orng-0.1.0a4-py3-none-any.whl -
Subject digest:
5818f7cc2f6ecefb055b30b871667ab7177b9beb7f5f5bf27131f2b7d9bf7d7b - Sigstore transparency entry: 749137481
- Sigstore integration time:
-
Permalink:
sequince-dev/orng@2dcfffc01a7a944ec1482e6898383cbb340c2972 -
Branch / Tag:
refs/tags/v0.1.0a4 - Owner: https://github.com/sequince-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2dcfffc01a7a944ec1482e6898383cbb340c2972 -
Trigger Event:
release
-
Statement type: