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.
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.
Depending on the instance, this method might panic, e.g. if the
parameters are invalid. See the particular instance's documentation for
details.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
Generates a uniformly distributed integer in the range.
Panics if self.start >= self.end
.
Generates a uniformly distributed integer in the inclusive range.
Panics if self.start > self.end
.
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 if self.start >= self.end
.
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 if self.start > self.end
.
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 if self.start >= self.end
.
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 if self.start > self.end
.
Returns true
with a given probability.
self
is the probability with which true
is returned.
Panics if self
is not in [0.0, 1.0], i.e. if self
is not a
probability.
Returns true
with a given probability.
self
is the probability with which true
is returned.
Panics if self
is not in [0.0, 1.0], i.e. if self
is not a
probability.