• 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: Seeding random() randomly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeding random() randomly


  • Subject: Re: Seeding random() randomly
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 27 May 2011 08:50:42 -0700

On May 26, 2011, at 9:04 PM, Scott Ribe wrote:

>> It’s never a good idea to seed a RNG with something guessable like this.
>
> Not all applications of random() have anything to do with security…

Agreed. But I didn’t say it was always a bad idea, just never a good one. :) Seeding with something like a timestamp gives you results that are neither repeatable nor truly unguessable, and I can’t think of any situation where that would be a benefit. Especially when it’s more work than just calling srandomdev().

Besides, people tend to search for snippets of existing code and paste them into new code, and it would be sad if code like the above got moved from, say, a game to, say, a password generator.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Seeding random() randomly (From: Kevin Bracey <email@hidden>)
 >Re: Seeding random() randomly (From: Jens Alfke <email@hidden>)
 >Re: Seeding random() randomly (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Seeding random() randomly
  • Next by Date: Re: How to see a video from YouTube on Iphone
  • Previous by thread: Re: Seeding random() randomly
  • Next by thread: Re: Seeding random() randomly
  • Index(es):
    • Date
    • Thread