• 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: Best way to get a non-repeating random number?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to get a non-repeating random number?


  • Subject: Re: Best way to get a non-repeating random number?
  • From: Peter Castine <email@hidden>
  • Date: Thu, 16 Apr 2009 11:51:54 +0200

On 15-Apr-2009, at 18:46, Michael Ash wrote, quoting Eric E. Dolecki:

int result = (arc4random()%9) + 1;
if (result >= activeTarget) ++result;
activeTarget = result;

No it won't.

Sorry, you're right; I was wrong. I wrote after a too brief analysis of the code. It's actually a rather algorithm. I apologize for the noise. The punishment for my error is that it will be indexed by Google for what passes on the Internet as eternity.


My other points about Mersenne Twister burstiness, etc. stand.

-- Peter
_______________________________________________

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: 
 >Best way to get a non-repeating random number? (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: "Luca C." <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Uli Kusterer <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Michael Ash <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Uli Kusterer <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Ricky Sharp <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Peter Castine <email@hidden>)
 >Re: Best way to get a non-repeating random number? (From: Michael Ash <email@hidden>)

  • Prev by Date: sending emails using URLRequest and php
  • Next by Date: Re: filteredArrayUsingPredicate and points
  • Previous by thread: Re: Best way to get a non-repeating random number?
  • Next by thread: Re: Best way to get a non-repeating random number?
  • Index(es):
    • Date
    • Thread