• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: rand() and srand() broken?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rand() and srand() broken?


  • Subject: Re: rand() and srand() broken?
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 25 Nov 2009 10:45:42 -0800


On Nov 25, 2009, at 9:26 AM, Derek Gaston wrote:

Hello everyone... I've been struggling with rand and srand on OSX 10.6 and 10.5. It seems to me that something is terribly broken.

You shouldn't be using rand; it's not a good PRNG and it was obsoleted ages ago by random().
Even the man page tells you not to use it:


RAND(3) BSD Library Functions Manual RAND(3)

NAME
     rand, rand_r, srand, sranddev -- bad random number generator
...
DESCRIPTION
     These interfaces are obsoleted by random(3).

—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [APPL:DarwinDev] Re: rand() and srand() broken?
      • From: "Jay A. Kreibich" <email@hidden>
    • Re: rand() and srand() broken?
      • From: Derek Gaston <email@hidden>
References: 
 >rand() and srand() broken? (From: Derek Gaston <email@hidden>)

  • Prev by Date: Re: rand() and srand() broken?
  • Next by Date: Re: rand() and srand() broken?
  • Previous by thread: Re: rand() and srand() broken?
  • Next by thread: Re: rand() and srand() broken?
  • Index(es):
    • Date
    • Thread