gluon 0.13.1

A static, type inferred programming language for application embedding
Documentation
//! Basic random number generation
//!
//! _This module is only available if gluon is compiled with the `rand` feature._

let prim @ { XorShiftRng } = import! std.random.prim

type RandomGen g = { next : g -> { value : Int, gen : g } }

let xor_shift_rng =
    let random_gen : RandomGen XorShiftRng = {
        next = prim.xor_shift_next
    }

    {
        new = prim.xor_shift_new,
        random_gen,
    }

{
    RandomGen,
    XorShiftRng,

    xor_shift_rng,

    thread_rng = {
        next_int = prim.next_int,
        next_float = prim.next_float,
        gen_int_range = prim.gen_int_range,
    },
}