Struct sungod::Ra[][src]

pub struct Ra { /* fields omitted */ }

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

Implementations

impl Ra[src]

pub fn new_random() -> Self[src]

Initalizes with the time since UNIX_EPOCH.

pub fn global<'t>() -> &'t mut Ra[src]

This function is kinda “unsafe”, race conditions might corrupt the random state. I’d personally write this off as a “feature” since it’s just more noise!

It might be annoying if you’re trying to reproduce bugs tough, so beware.

pub fn new_with(seed: u64) -> Self[src]

pub fn seed(&mut self, seed: u64)[src]

pub fn xorwow(&mut self) -> u64[src]

The random source, spits out random u64s

pub fn sample<T: Sample>(&mut self) -> T[src]

Spits out a random of whatever.

pub fn gen<T: Sample>(&mut self) -> T[src]

Spits out a random of whatever. Same as sample, but makes it easier to port from Rand.

Trait Implementations

impl Clone for Ra[src]

impl Copy for Ra[src]

impl Debug for Ra[src]

impl Default for Ra[src]

Auto Trait Implementations

impl RefUnwindSafe for Ra

impl Send for Ra

impl Sync for Ra

impl Unpin for Ra

impl UnwindSafe for Ra

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.