This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34096] Random number generates the same set of numbers
- From: "wilson at specifix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Nov 2007 01:41:04 -0000
- Subject: [Bug c/34096] Random number generates the same set of numbers
- References: <bug-34096-15356@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from wilson at specifix dot com 2007-11-15 01:41 -------
Subject: Re: Random number generates the same set of numbers
rsanghavi at gmail dot com wrote:
> ------- Comment #2 from rsanghavi at gmail dot com 2007-11-14 22:32 -------
> But, even if you seed it, the result is the same unless you seed it with a
> random number. I use (time(0) + random number) as seed in my code.
Try reading the documentation. On a unix box, you can do "man random"
to get docs, which will tell you that it works this way by design.
> I am unaware and so asking you, if you have any idea of the project name random
> function belongs to?
It is part of the C library. Where the C library comes from depends on
the OS, which wasn't specified. They will tell you the same thing we
just told you though.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34096