trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] Remove value modification decision from plus_minus_two()
@ 2015-03-04 21:09 tyson.w.smith
  2015-03-12 13:25 ` Dave Jones
  0 siblings, 1 reply; 2+ messages in thread
From: tyson.w.smith @ 2015-03-04 21:09 UTC (permalink / raw)
  To: davej; +Cc: trinity, Tyson Smith

From: Tyson Smith <tyson.w.smith@gmail.com>

---
 interesting-numbers.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/interesting-numbers.c b/interesting-numbers.c
index e77ec80..c0805ab 100644
--- a/interesting-numbers.c
+++ b/interesting-numbers.c
@@ -7,15 +7,14 @@
 static unsigned int plus_minus_two(unsigned int num)
 {
 	/* Now munge it for off-by-ones. */
-	switch (rand() % 5) {
+	switch (rand() % 4) {
 	case 0:	num -= 2;
 		break;
 	case 1:	num -= 1;
 		break;
-	case 2:	return num;
-	case 3:	num += 1;
+	case 2:	num += 1;
 		break;
-	case 4:	num += 2;
+	case 3:	num += 2;
 		break;
 	}
 	return num;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-12 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 21:09 [PATCH 1/7] Remove value modification decision from plus_minus_two() tyson.w.smith
2015-03-12 13:25 ` Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).