tfprng: expose range formula in form of macros to build custom range generators.
This commit is contained in:
parent
acf1671280
commit
65a3fc67f2
2
tfprng.c
2
tfprng.c
|
@ -85,7 +85,7 @@ TFNG_UNIT_TYPE tfng_prng_range_r(void *sdata, TFNG_UNIT_TYPE s, TFNG_UNIT_TYPE d
|
|||
{
|
||||
TFNG_UNIT_TYPE c = tfng_prng_random_r(sdata);
|
||||
if (d <= s) return s;
|
||||
return s + c / ((TFNG_UNIT_TYPE)~0 / (d - s + 1) + 1);
|
||||
return TFNG_PRNG_RANGE(c, TFNG_UNIT_TYPE, s, d);
|
||||
}
|
||||
|
||||
TFNG_UNIT_TYPE tfng_prng_range(TFNG_UNIT_TYPE s, TFNG_UNIT_TYPE d)
|
||||
|
|
Loading…
Reference in New Issue