From 532d4a24e2013262dfa41fd85c06a9715c99abf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 24 Oct 2022 21:03:42 +0200 Subject: New upstream version 4.7 --- doc/random_numbers.rst | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 doc/random_numbers.rst (limited to 'doc/random_numbers.rst') 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 + + 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. -- cgit v1.2.3