Idiom # 69: Seed random generator
Random numbers generators in Fuzion are effects. To use a random number
generator with a particular seed, we have to create an instance
of simple_random_provider with the given seed and run code with this
this effect in its environment. The standard library
feature simple_random creates such a random provider with the given
seed and installs it as the environment for running the code provided with the
function parameter f.
Code
Running Example
The following example provides a feature seed that executes a
function f with in an environment with a seeded random number
generator. For illustration, show_random is called in this context
and also in the default random provider and an explicitly time seeded random
provider: