summaryrefslogtreecommitdiff
path: root/doc/random_numbers.rst
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-02-10 15:27:06 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-02-10 15:27:06 +0100
commit7501bff8432444b7ae8e7f3d9289c0d61f3f0b64 (patch)
treebd53603f464c3747e897a8996158a0fef7b41bc3 /doc/random_numbers.rst
parent0f124df68d87c9073f76efeff1a901a69b1f3e13 (diff)
parent9e9336185f86bd97ff22f54e4d561c2cccccecf5 (diff)
Merge branch 'release/debian/4.10-1'debian/4.10-1
Diffstat (limited to 'doc/random_numbers.rst')
-rw-r--r--doc/random_numbers.rst32
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.