diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-10-24 21:04:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-10-24 21:04:00 +0200 |
commit | 3422d8db505630a70bc89a4eee7db927b8e5ec2f (patch) | |
tree | f0c6e1ba7db9991f2bd38c9169f9921bfe5e61d8 /doc/random_numbers.rst | |
parent | df5167db909a88fb8e16dd20b37442495a6ac059 (diff) | |
parent | aab49e5a013c53ae812a143fe41add74e0677a61 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'doc/random_numbers.rst')
-rw-r--r-- | doc/random_numbers.rst | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/random_numbers.rst b/doc/random_numbers.rst new file mode 100644 index 0000000..2b87d5d --- /dev/null +++ b/doc/random_numbers.rst @@ -0,0 +1,32 @@ +============== +Random numbers +============== + +Function overview +================= + +.. code-block:: c + + #include <libHX/misc.h> + + int HX_rand(void); + unsigned int HX_irand(unsigned int min, unsigned int max); + double HX_drand(double min, double max); + +``HX_rand`` + Retrieve the next random number. + +``HX_irand`` + Retrieve the next random number and fold it such that *min <= n < max*. + +``HX_drand`` + Retrieve the next random number and fold it such that *min <= n < max*. + +Implementation information +========================== + +``/dev/urandom`` will be used to seed the libc-level number generator. + +``/dev/random`` is not used on Linux because it may block during read, and +/dev/urandom is just as good when there is entropy available. If you need +definitive PRNG security, perhaps use one from a crypto suite such as OpenSSL. |