Re: rand() and srand() broken?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=B9dYjggVI5lcTlegAXvOPOThK8I653rifac2q496Uls=; b=TU47kBaOBSWLeWsIceXqkAV86QRjBrGo4s1TAxZINNSQCNxMiwXaLiAK6tSoxyp/ne rpz+xTE7mSzh2WExebAqaCSUY1nkkoDGKDiU2SU5d1DETCb5ieCkLvOtIuDfCT+WIr4h IMFkYXqHJOda/hyB2R1odOxPtq6YyVLYpRknc= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=QuHH9VyI34mV55S22iVFnmRlTfLeuAPfmqnG2JnbO76VQTTJBtY+coN2+iNkactqDg JlYmKd4fzr6V+MN9RZhVS2Pir6497CpKx5/UC68j5y4sMPRuLhHuzW22UDpru5zVSitJ kfNMqWZTqblX0Exe+kjDnoMu5V6tSJEe8yAQE= On Nov 25, 2009, at 12:41 PM, Clark Cox wrote:
Yes. If you pass the same value to seed(), you will get the same sequence of values from rand(). Period. Any implementation of srand/rand that does not do this is broken. From the C Standard:
Indeed... note that this wasn't about passing the _same_ value... it was about passing similar values to srand... like singularly increasing integers... Derek _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Derek Gaston