Crate sungod[][src]

A simple and super slim random crate, gifted from the sun God!

If you need decent random numbers pretty speedily, and hate to wait for compile-times, this is the crate for you! No dependencies, no worries!

A basic usage would look like this:

use sungod::Ra;
fn main() {
    let mut ra = Ra::default();
    assert_ne!(ra.sample::<u64>(), ra.sample::<u64>());

I personally like to:

use sungod::Ra;
fn main() {
    assert_ne!(Ra::ggen::<u64>(), Ra::ggen::<u64>());

This uses the thread local random number generator, which can be configured to be random.

This is an implementation of xorwow, in a nice slim package, with some extra type safety. If you want to support randomizing more exotic types, you’ll have to implement it yourself. No fancy traits or anything in this crate.

NOTE: This crate is not at all suitable for cryptographic use.

Feature flags

The sungod is merciful, and thus allows petty humans to choose some things for themselves.

# No standard library
sungod = { version = "x.y", default-features = false }
# Make the default constructor random
sungod = { version = "x.y", features = ["default_is_random"] }



The struct that holds all the random state. Can be instanced as many times as you want!



The sexiest of seeds.



How to make a random of whatever from random u64s.