From 4c3ae4d7e727eac6f6eb23587cef0413734d4ae1 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 22 Feb 2007 01:26:32 -0800 Subject: [IPV4]: Use random32() in net/ipv4/multipath Removed local random number generator function Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- net/ipv4/multipath_random.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'net/ipv4/multipath_random.c') diff --git a/net/ipv4/multipath_random.c b/net/ipv4/multipath_random.c index 57f481498fb..c312785d14d 100644 --- a/net/ipv4/multipath_random.c +++ b/net/ipv4/multipath_random.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -48,21 +49,6 @@ #define MULTIPATH_MAX_CANDIDATES 40 -/* interface to random number generation */ -static unsigned int RANDOM_SEED = 93186752; - -static inline unsigned int random(unsigned int ubound) -{ - static unsigned int a = 1588635695, - q = 2, - r = 1117695901; - - RANDOM_SEED = a*(RANDOM_SEED % q) - r*(RANDOM_SEED / q); - - return RANDOM_SEED % ubound; -} - - static void random_select_route(const struct flowi *flp, struct rtable *first, struct rtable **rp) @@ -84,7 +70,7 @@ static void random_select_route(const struct flowi *flp, if (candidate_count > 1) { unsigned char i = 0; unsigned char candidate_no = (unsigned char) - random(candidate_count); + (random32() % candidate_count); /* find chosen candidate and adjust GC data for all candidates * to ensure they stay in cache -- cgit v1.2.3