Message ID | 1322132254-5830-1-git-send-email-j.weitzel@phytec.de |
---|---|
State | Accepted |
Commit | 1cf7295ecd343090e7327bade716f25e0bf737cb |
Headers | show |
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
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 --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':
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(-)