[m-users.] The new random module(s)

Julien Fischer jfischer at opturion.com
Thu Sep 5 14:40:46 AEST 2019


Hi Julian,

On Wed, 4 Sep 2019, Julian Fondren wrote:

> One benefit to the new code is that you don't need to use the FFI (or
> read from a random device) just to get a random seed.

The intention here is that the stdlib will provide an interface to
a random device on the system (/dev/random etc, whatever is appropriate
for the underlying target language / platform).

> But my code is still a little weird:
>
>   main(!IO) :-
>       random.generate_uint64(Seed, random.sfc16.init, _), % new stuff
>       random.init(uint64.cast_to_int(Seed), RS),          % old stuff
>       fifteen.shuffled(Board, RS, _),
>       ...
>
> Why the mix?  array.random_permutation and random.permutation have been
> left behind, and only work with a random.supply.

We are going to add replacements for both of the above that work with
the new type classes.

Julien.


More information about the users mailing list