This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ 14561] Separate rand and random seeds.
- From: Rich Felker <dalias at aerifal dot cx>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Thu, 23 May 2013 16:13:33 -0400
- Subject: Re: [PATCH][BZ 14561] Separate rand and random seeds.
- References: <20130520190628 dot GA22088 at domone dot kolej dot mff dot cuni dot cz> <20130523191141 dot 1C6532C0A2 at topped-with-meat dot com> <20130523192121 dot GA11832 at domone dot kolej dot mff dot cuni dot cz> <20130523192922 dot 086AE2C09F at topped-with-meat dot com>
On Thu, May 23, 2013 at 12:29:22PM -0700, Roland McGrath wrote:
> I see no reason to think that this change is desireable.
The current behavior is non-conforming. Consider the program:
int main(int argc, char **argv)
{
srand(1);
printf("%d\n", rand());
if (argc>1) srandom(1);
printf("%d\n", rand());
}
This program is required by the standard to print the same results
regardless of the number of arguments passed. Presently, it does not.
Other better examples of non-conformance can be constructed if you
care.
Rich