aboutsummaryrefslogtreecommitdiff
path: root/lib/debugobjects.c
diff options
context:
space:
mode:
authorDaniel Borkmann <[email protected]>2014-01-22 02:29:39 +0100
committerDavid S. Miller <[email protected]>2014-01-21 23:17:20 -0800
commitf337db64af059c9a94278a8b0ab97d87259ff62f (patch)
treeef7db2258d5929760f2a22b74779d374916634bd /lib/debugobjects.c
parent6cd28f044b47aeeba91807d97d6f3ea5a048e88d (diff)
random32: add prandom_u32_max and convert open coded users
Many functions have open coded a function that returns a random number in range [0,N-1]. Under the assumption that we have a PRNG such as taus113 with being well distributed in [0, ~0U] space, we can implement such a function as uword t = (n*m')>>32, where m' is a random number obtained from PRNG, n the right open interval border and t our resulting random number, with n,m',t in u32 universe. Lets go with Joe and simply call it prandom_u32_max(), although technically we have an right open interval endpoint, but that we have documented. Other users can further be migrated to the new prandom_u32_max() function later on; for now, we need to make sure to migrate reciprocal_divide() users for the reciprocal_divide() follow-up fixup since their function signatures are going to change. Joint work with Hannes Frederic Sowa. Cc: Jakub Zawadzki <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: [email protected] Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'lib/debugobjects.c')
0 files changed, 0 insertions, 0 deletions