Skip to main content

Random search, shuffle, and pick using a custom RanBit RNG and fisher-yates algorithm

Project description

๐Ÿ“ฆ domino_rng

Domino RNG is a lightweight Python package that provides:

A custom ultra-fast XOR-shift inspired random generator (RanBit)

Randomized array search (domino_search)

Random shuffle (domino_shuffle)

Random element picking (domino_pick)

All randomness is powered by the RanBit engine, which uses a time-based seed to produce a new pseudo-random sequence on each run.

Inspired by the X-Men character Domino, this package focuses on probability manipulation, fast randomness, and lightweight random utilities.

๐Ÿš€ Features

๐Ÿ”ฅ RanBit โ€” fast custom random number generator

๐Ÿ”„ domino_search โ€” random search with neighbor optimization

๐Ÿ”€ domino_shuffle โ€” random array shuffling

๐ŸŽฏ domino_pick โ€” fast random element selector

โฑ๏ธ Time-seeded RNG: every run produces unique randomness

๐Ÿงฉ No external dependencies

โšก Very lightweight and fast โ€” optimized for small/medium arrays

๐ŸŽฎ Great for games, probabilistic algorithms, randomized utilities

๐Ÿ“ฅ Installation

Once published to PyPI:

pip install domino_rng

๐Ÿ“˜ Usage ๐Ÿ’  Import the functions from domino_rng import domino_search, domino_shuffle, domino_pick

๐Ÿ” Example โ€” Random Search from domino_rng import domino_search

arr = [2, 5, 6, 7, 2, 10] result = domino_search(arr, 10)

print("Found at search iteration:", result)

domino_search returns the iteration number at which the target is found.

๐Ÿ”€ Example โ€” Shuffle an Array from domino_rng import domino_shuffle

arr = [5, 1, 4, 8, 2, 11, 0, -1, 2] shuffled = domino_shuffle(arr)

print(shuffled)

Each run produces a different random shuffle.

๐ŸŽฏ Example โ€” Random Pick from domino_rng import domino_pick

print(domino_pick([1, 2, 3, 4, 5]))

Returns a random element from the list.

๐Ÿง  Algorithm Details RanBit โ€” Custom Random Generator

Domino RNG uses a custom XOR-shift algorithm:

x ^= x << 13 x ^= x >> 17 x ^= x << 5

This produces a fast 32-bit pseudo-random sequence. A time-based seed (time.time() * 1000) ensures every program run is unique.

domino_search โ€” Random Search with Neighbor Check

This search algorithm:

Randomly selects an index r

Also checks the neighbor r-1

If either matches the target, search ends

Otherwise, the two checked elements are swapped away from the search range

Search becomes faster and avoids repeated checks

It produces a probabilistic search sequence that reduces redundant operations.

domino_shuffle โ€” Randomized Fisher-Yates Variant

Randomly picks an index using RanBit

Swaps it with the current end of the array

Moves the boundary to avoid reusing elements

Very fast and lightweight

๐Ÿ“ฆ Project Structure domino_rng/ โ”‚ โ”œโ”€โ”€ domino_rng/ โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ”œโ”€โ”€ search.py โ”‚ โ””โ”€โ”€ _ranbit.py โ”‚ โ”œโ”€โ”€ setup.py โ”œโ”€โ”€ README.md โ””โ”€โ”€ LICENSE

๐Ÿ› ๏ธ Implementation Philosophy

Keep RNG internal and invisible to user

Expose simple API functions only

Maintain a clean, minimal interface

Provide deterministic logic without external dependencies

Make randomness fast, small, and efficient

๐Ÿงช Performance Notes

Faster than Python's built-in random for small array operations

Ideal for:

random searching

small Monte-Carlo steps

shuffling lists

producing quick random choices

game logic where lightweight RNG is needed

Not a cryptographic RNG

โš ๏ธ Disclaimer

This RNG is not suitable for:

Cryptographic security

Scientific simulations requiring high-quality random distribution

It is intended for lightweight, high-speed probabilistic operations.

๐Ÿ‘จโ€๐Ÿ’ป Author

Shiv Shankar N Developer of the Domino RNG package.

โญ Contribution

Pull requests and suggestions are welcome. Feel free to open issues for discussions or improvements.

๐Ÿ“„ License

MIT License Free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domino_rng-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

domino_rng-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file domino_rng-1.0.0.tar.gz.

File metadata

  • Download URL: domino_rng-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for domino_rng-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3b03ab6fe09f9ee0ffe0cdf9a4280b5e2511ff34b54000240463895c7abe1486
MD5 28c74fb0361d98db6e694074184c6d89
BLAKE2b-256 3a3f4031174e256e2f0780e99fa8a94f44ebe1b6c6b1d998741e4e6d09ab42b2

See more details on using hashes here.

File details

Details for the file domino_rng-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: domino_rng-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for domino_rng-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43b22d75a0650a07c08e943b9b3adcaffd0d19f6957aa9a0dd736c572da08ba3
MD5 ebe85c5cb702cf404c8ec14b7f2c3a46
BLAKE2b-256 61a2e5eae2b635cfc1c298db9e17891d5074529b018098968483bb97e5371eba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page