jlouis / enacl

Erlang bindings for NaCl / libsodium
MIT License
197 stars 59 forks source link

Functions to generate random integers #24

Closed ghost closed 4 years ago

ghost commented 6 years ago

This pull request is for functions generating random integers.

randomint/0 returns an unpredictable value between 0 and 0xffffffff (included). randomint/1 function returns an unpredictable value between 0 and given upper bound (excluded) randomint/2 function returns an unpredictable value between lower and upper bounds (included)

NOTE: The documentation for randomint/2 may be incorrect.

jlouis commented 6 years ago

Sorry for letting this sit for too long.

Some comments:

jlouis commented 4 years ago

Long overdue, but I've implemented enacl:randombytes_uint32/0 and enacl:randombytes_uniform/1 on master now.

There are some changes compared to this proposal:

I've opted to not implement randombytes_uniform/2: