[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tyson Smith <tysmith@xxxxxxxxxxxx>

Removed rand8x8() function since it is essentially the same as a call
to RAND_32 or RAND_64.
---
 random.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/random.c b/random.c
index f425ed5..adee25e 100644
--- a/random.c
+++ b/random.c
@@ -90,20 +90,6 @@ static unsigned long randbits(int limit)
 }
 
 /*
- * Pick 8 random bytes, and concatenate them into a long.
- */
-static unsigned long rand8x8(void)
-{
-	unsigned long r = 0UL;
-	unsigned int i;
-
-	for (i = rand_range(1, 7); i > 0; --i)
-		r = (r << 8) | rand() % 256;
-
-	return r;
-}
-
-/*
  * Pick 1 random byte, and repeat it through a long.
  */
 static unsigned long rept8(unsigned int num)
@@ -127,18 +113,16 @@ static unsigned int __rand32(void)
 {
 	unsigned long r = 0;
 
-	switch (rand() % 6) {
+	switch (rand() % 5) {
 	case 0: r = rand_single_bit(32);
 		break;
 	case 1:	r = randbits(32);
 		break;
 	case 2: r = RAND_32();
 		break;
-	case 3:	r = rand8x8();
-		break;
-	case 4:	r = rept8(4);
+	case 3:	r = rept8(4);
 		break;
-	case 5:	return get_interesting_value();
+	case 4:	return get_interesting_value();
 	}
 
 	return r;
@@ -211,19 +195,17 @@ u64 rand64(void)
 
 	} else {
 		/* 33:64-bit ranges. */
-		switch (rand() % 6) {
+		switch (rand() % 5) {
 		case 0:	r = rand_single_bit(64);
 			break;
 		case 1:	r = randbits(64);
 			break;
 		case 2:	r = RAND_64();
 			break;
-		case 3:	r = rand8x8();
-			break;
-		case 4:	r = rept8(8);
+		case 3:	r = rept8(8);
 			break;
 		/* Sometimes pick a not-so-random number. */
-		case 5:	return get_interesting_value();
+		case 4:	return get_interesting_value();
 		}
 
 		/* limit the size */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe trinity" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux