A type that can be (pseudo-)randomly generated using a RandomGen
.
Randomly generates a value.
In general, the generates values will be uniformly distributed in some
way. See the instance documentations for more details.
In most cases, you might want to use RandomGen
's wrapper method
gen
instead of writing out Random::random
or Type::random
.
use tiamat::Random;
let mut rng = get_rng();
for i in 1..6 {
let result = if bool::random(&mut rng) {
"heads"
} else {
"tails"
};
println!("Coin flip #{}: {}!", i, result);
}
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates values that are uniformly distributed among all
possible values.
Generates uniformly distributed values in the closed interval
[0.0, 1.0].
Here, uniformly distributed that the generated values are as
if a random real number in [0.0, 1.0] was generated and then
rounded to the nearest floating point number.
Generates uniformly distributed values in the closed interval
[0.0, 1.0].
Here, uniformly distributed that the generated values are as
if a random real number in [0.0, 1.0] was generated and then
rounded to the nearest floating point number.
Returns true
and false
with equal probability.
Returns Some(rng.gen())
and None
with equal probability.
The Some
and None
variants have equal probability; if a Some
is
generated, then the value inside is generated with its Random
instance.
Returns a char
uniformly distributed among legal values, i.e. among
Unicode scalar values.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.
Returns a tuple where each value was generated according to its
own implementation of Random
.