Trait tiamat::BuildRandom[][src]

pub trait BuildRandom<R> {
    fn build<G: RandomGen>(&self, rng: &mut G) -> R;
}

A type defining some distribution for generating (pseudo-)random values.

If a type B implements BuildRandom<R>, then B can be used to generate values of R in some distribution.

Required Methods

Randomly generates a value according to some distribution.

self specifies a distribution for generating an R using a RandomGen.

RandomGen provides the wrapper method build, which may (or may not) be more convenient.

Panics

Depending on the instance, this method might panic, e.g. if the parameters are invalid. See the particular instance's documentation for details.

Implementations on Foreign Types

impl BuildRandom<u8> for Range<u8>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<u8> for RangeInclusive<u8>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<u16> for Range<u16>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<u16> for RangeInclusive<u16>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<u32> for Range<u32>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<u32> for RangeInclusive<u32>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<u64> for Range<u64>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<u64> for RangeInclusive<u64>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<u128> for Range<u128>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<u128> for RangeInclusive<u128>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<usize> for Range<usize>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<usize> for RangeInclusive<usize>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<i8> for Range<i8>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<i8> for RangeInclusive<i8>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<i16> for Range<i16>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<i16> for RangeInclusive<i16>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<i32> for Range<i32>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<i32> for RangeInclusive<i32>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<i64> for Range<i64>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<i64> for RangeInclusive<i64>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<i128> for Range<i128>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<i128> for RangeInclusive<i128>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<isize> for Range<isize>
[src]

Generates a uniformly distributed integer in the range.

Panics

Panics if self.start >= self.end.

impl BuildRandom<isize> for RangeInclusive<isize>
[src]

Generates a uniformly distributed integer in the inclusive range.

Panics

Panics if self.start > self.end.

impl BuildRandom<f32> for Range<f32>
[src]

Generates a uniformly distributed floating point value in the range.

Note that as of 2017-07-22, not all possibble values in the range are generated; the number of possible values is currently bound by the number of values generatable by the float types' Random instance.

Panics

Panics if self.start >= self.end.

impl BuildRandom<f32> for RangeInclusive<f32>
[src]

Generates a uniformly distributed floating point value in the range.

Note that as of 2017-07-22, not all possibble values in the range are generated; the number of possible values is currently bound by the number of values generatable by the float types' Random instance.

Panics

Panics if self.start > self.end.

impl BuildRandom<f64> for Range<f64>
[src]

Generates a uniformly distributed floating point value in the range.

Note that as of 2017-07-22, not all possibble values in the range are generated; the number of possible values is currently bound by the number of values generatable by the float types' Random instance.

Panics

Panics if self.start >= self.end.

impl BuildRandom<f64> for RangeInclusive<f64>
[src]

Generates a uniformly distributed floating point value in the range.

Note that as of 2017-07-22, not all possibble values in the range are generated; the number of possible values is currently bound by the number of values generatable by the float types' Random instance.

Panics

Panics if self.start > self.end.

impl BuildRandom<bool> for f32
[src]

Returns true with a given probability.

self is the probability with which true is returned.

Panics

Panics if self is not in [0.0, 1.0], i.e. if self is not a probability.

impl BuildRandom<bool> for f64
[src]

Returns true with a given probability.

self is the probability with which true is returned.

Panics

Panics if self is not in [0.0, 1.0], i.e. if self is not a probability.

Implementors