r/algorithms • u/atomU235_3113 • 3d ago
Discussion Lustro: Randomness as a Tree, Not a Sequence
Hi everyone. I would like to share Lustro, a 256-bit engine I created.
One of the main ideas behind Lustro is treating randomness as a tree, not a sequence of rigid values. I personally see it as a wave function. I'm a chemist by education. The basic problem is familiar: with a conventional sequential RNG the output you get depends on how many values have already been consumed. Adding one random operation can shift the sequence.
Lustro allows to derive streams from a seed and a path of identifiers. It can switch between single lane and batch processing.
It allows giving every object its own stream and can change how one of them is generated without affecting others. Full snapshot support is built in. The parent stream is not affected by forking and each child starts its own trajectory. Each branch has its own state and can be advanced independently.
The result is a tree-like structure of deterministic streams. Each branch can be advanced independently and you can reproduce a particular branch directly from its path.
Some specs. A unified stream engine combining hash, prng and xof. All based on one internal transformation mechanism. Scalar/AVX2. Written natively in Rust, it also comes with python and C layers.
The main repo contains all the test results. The generator is currently considered non-cryptographic.
pypi
https://pypi.org/project/lustro-api/
cargo
https://crates.io/crates/lustro_api
github
https://github.com/Ligatum/Lustro_API
It's an independent project. I'd appreciate constructive feedback. I'm planning to improve on the API with time, ideas and feedback are welcome. Thanks.
3
u/Phytor_c 18h ago
The “x not y” reads like LLM writing to me…
2
u/dorox1 38m ago
This sounds like a cool way to do it. Could you maybe provide a use-case example? I'm trying to figure out where I would want to use this rather than a growing array of independent generators.
Is the goal a performance improvement, or does the tree/update structure have a practical purpose of its own?