7 releases

0.3.1 Apr 7, 2021
0.3.0 Apr 7, 2021
0.2.2 Apr 4, 2021
0.2.1 Mar 31, 2021
0.1.2 Mar 31, 2021

#1234 in Game dev

Download history 24/week @ 2024-04-07 35/week @ 2024-04-14 28/week @ 2024-04-21 27/week @ 2024-04-28 21/week @ 2024-05-05 24/week @ 2024-05-12 26/week @ 2024-05-19 27/week @ 2024-05-26 28/week @ 2024-06-02 15/week @ 2024-06-09 25/week @ 2024-06-16 21/week @ 2024-06-23 23/week @ 2024-06-30 6/week @ 2024-07-07 24/week @ 2024-07-14 17/week @ 2024-07-21

71 downloads per month
Used in 4 crates (3 directly)

MIT/Apache

10KB
197 lines

Sungod Ra

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>());
}

If you want to run in no_std-environments you need to build without default features. E.g., in your Cargo.toml:

sungod = { version = "x.y", default-features = false }

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 create is not at all suitable for cryptographic use.


lib.rs:

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"] }

No runtime deps

Features