New upstream version 4.16.0

This commit is contained in:
Chris Hofstaedtler
2024-06-25 20:09:23 +02:00
parent 0fda4df4f1
commit e8b8d7a84b
488 changed files with 2122 additions and 2883 deletions
+2 -10
View File
@@ -23,7 +23,6 @@
#include "sizeof.h"
static uint32_t csrand32(void);
static uint32_t csrand_uniform32(uint32_t n);
static unsigned long csrand_uniform_slow(unsigned long n);
@@ -98,13 +97,6 @@ csrand_interval(unsigned long min, unsigned long max)
}
static uint32_t
csrand32(void)
{
return csrand();
}
/*
* Fast Random Integer Generation in an Interval
* ACM Transactions on Modeling and Computer Simulation 29 (1), 2019
@@ -117,12 +109,12 @@ csrand_uniform32(uint32_t n)
uint64_t r, mult;
if (n == 0)
return csrand32();
return csrand();
bound = -n % n; // analogous to `2^32 % n`, since `x % y == (x-y) % y`
do {
r = csrand32();
r = csrand();
mult = r * n;
rem = mult; // analogous to `mult % 2^32`
} while (rem < bound); // p = (2^32 % n) / 2^32; W.C.: n=2^31+1, p=0.5