diff mbox

nandtest: use seed argument

Message ID 1322132254-5830-1-git-send-email-j.weitzel@phytec.de
State Accepted
Commit 1cf7295ecd343090e7327bade716f25e0bf737cb
Headers show

Commit Message

Jan Weitzel Nov. 24, 2011, 10:57 a.m. UTC
if a seed is provided it is actually not used. First call is
"seed = rand()" killing the given seed.

Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
 nandtest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Brian Norris Nov. 28, 2011, 5:56 p.m. UTC | #1
On Thu, Nov 24, 2011 at 2:57 AM, Jan Weitzel <j.weitzel@phytec.de> wrote:
> if a seed is provided it is actually not used. First call is
> "seed = rand()" killing the given seed.
>
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>

Tested-by: Brian Norris <computersforpeace@gmail.com>

You might also note that when a seed isn't provided, nandtest does not
produce random results because it just uses the default seed. At least
for my system, I see the same results every execution; I believe this
is the general C rand() behavior. I'll send a follow-up patch that
actually utilizes <time.h> to use time as a random seed.

Brian
Artem Bityutskiy Dec. 1, 2011, 7:56 a.m. UTC | #2
On Thu, 2011-11-24 at 11:57 +0100, Jan Weitzel wrote:
> if a seed is provided it is actually not used. First call is
> "seed = rand()" killing the given seed.
> 
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>

Pushed to mtd-utils.git, thanks!

Artem.
diff mbox

Patch

diff --git a/nandtest.c b/nandtest.c
index db7f427..b3aacaf 100644
--- a/nandtest.c
+++ b/nandtest.c
@@ -173,6 +173,7 @@  int main(int argc, char **argv)
 
 		case 's':
 			seed = atol(optarg);
+			srand(seed);
 			break;
 
 		case 'p':