From: tyson.w.smith@gmail.com
To: davej@codemonkey.org.uk
Cc: trinity@vger.kernel.org, Tyson Smith <tyson.w.smith@gmail.com>
Subject: [PATCH 1/7] Remove value modification decision from plus_minus_two()
Date: Wed, 4 Mar 2015 13:09:55 -0800 [thread overview]
Message-ID: <1425503395-37972-1-git-send-email-tyson.w.smith@gmail.com> (raw)
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
next reply other threads:[~2015-03-04 21:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 21:09 tyson.w.smith [this message]
2015-03-12 13:25 ` [PATCH 1/7] Remove value modification decision from plus_minus_two() Dave Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425503395-37972-1-git-send-email-tyson.w.smith@gmail.com \
--to=tyson.w.smith@gmail.com \
--cc=davej@codemonkey.org.uk \
--cc=trinity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).