Module rust_monster::ga::ga_random [] [src]

GA Random Numbers Util

Wrapper around the rand crate that provides a Seeded and Stateful Random Number Generator.

Internally uses rand::XorShiftRng for speed purposes.

Examples

GARandomCtx - Basic Use case

extern crate rust_monster;
use rust_monster::ga; 
use rust_monster::ga::ga_random; 
 
fn main ()
{
    let seed : ga_random::GASeed = [1,2,3,4];

    let mut ga_ctx = ga_random::GARandomCtx::from_seed(seed, String::from("MyRandomCtx")); 

    println!("{:?}", ga_ctx.gen::<f32>());

    println!("{:?}", ga_ctx);
}

Structs

GARandomCtx

Type Definitions

GASeed