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

Re: Random()


  • Subject: Re: Random()
  • From: Andres Santiago Perez-Bergquist <email@hidden>
  • Date: Sun, 14 Dec 2003 00:33:35 -0600

On 13 Dec 2003, at 3:13 PM, Shaun Wexler wrote:

On Dec 13, 2003, at 12:41 PM, Joost Markerink wrote:

// how can i get a random float between 0 - 1, do i have to use C? how?

static const float rand_norm = 1.0f / (float)RAND_MAX;

#define RANDOM_FLOAT (rand_norm * (float)rand())

In general, for new code that does not depend on previously established sequences of pseudo-random numbers, you should use random() instead of rand(), as it provides superior levels of randomness.

-- Andres Santiago Perez-Bergquist
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Random() (From: Joost Markerink <email@hidden>)
 >Re: Random() (From: Shaun Wexler <email@hidden>)

  • Prev by Date: Bundle for Mail
  • Next by Date: Re: NSArray NSDictionary Tree Q.
  • Previous by thread: Re: Random()
  • Next by thread: Re: Random()
  • Index(es):
    • Date
    • Thread