[Bug 804355] Re: jot random number generator broken in batch jobs
Ubuntu Foundation's Bug Bot
804355 at bugs.launchpad.net
Thu Mar 15 16:13:35 UTC 2012
The attachment "jot-9.0-random-number-geterator.patch" of this bug
report has been identified as being a patch in the form of a debdiff.
The ubuntu-sponsors team has been subscribed to the bug report so that
they can review and hopefully sponsor the debdiff. In the event that
this is in fact not a patch you can resolve this situation by removing
the tag 'patch' from the bug report and editing the attachment so that
it is not flagged as a patch. Additionally, if you are member of the
ubuntu-sponsors team please also unsubscribe the team from this bug
report.
[This is an automated message performed by a Launchpad user owned by
Brian Murray. Please contact him regarding any issues with the action
taken in this bug report.]
** Tags added: patch
--
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/804355
Title:
jot random number generator broken in batch jobs
Status in “athena-jot” package in Ubuntu:
New
Bug description:
jot -r generates same random numbers within one second time so it's
unusable in batch jobs like shell scripts.
There is code for initializing "random" seed:
s = (randomize ? time(0) : STEP_DEF);
/*... snip ....*/
srand((int) s);
Here is an example of this behavior:
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455778
9981995
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455779
2355993
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455780
3745306
rbtz at rbtz-desktop:~$ date +%s; jot -r 1 0 10000000
1309455780
3745306
As fast fix pid can be added to seed
srandom((int) s ^ (getpid()<<4));
As good fix arc4random or similar mechanism can be used.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/athena-jot/+bug/804355/+subscriptions
More information about the Ubuntu-sponsors
mailing list