From 4e75b40d8a96c5d51490ddea43566fe8e6d4168c Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 9 Apr 2022 02:28:05 +0000 Subject: Prepare for 2.12.0.0. librandom revamp. Signed-off-by: Laurent Bercot --- src/librandom/random_uint32.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/librandom/random_uint32.c (limited to 'src/librandom/random_uint32.c') diff --git a/src/librandom/random_uint32.c b/src/librandom/random_uint32.c deleted file mode 100644 index 6700879..0000000 --- a/src/librandom/random_uint32.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ISC license. */ - -#include - -#ifdef SKALIBS_HASARC4RANDOM - -#include -#include -#include -#include - -uint32_t random_uint32 (uint32_t n) -{ - return arc4random_uniform(n) ; -} - -#else - -#include -#include - -uint32_t random_uint32 (uint32_t n) -{ - uint32_t min, x ; - if (n < 2) return 0 ; - min = -n % n ; - for (;;) - { - char tmp[4] ; - random_string(tmp, 4) ; - uint32_unpack_big(tmp, &x) ; - if (x >= min) break ; - } - return x % n ; -} - -#endif -- cgit v1.3.1