• 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 numbers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random numbers?


  • Subject: Re: Random numbers?
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 4 Jul 2007 16:39:28 -0400

On Jul 4, 2007, at 11:52 AM, Matt Neuburg wrote:

On Wed, 4 Jul 2007 09:43:41 -0500, William Squires <email@hidden>
said:
What's the proper way to get a random number in ObjC/Cocoa? I need it
in an NSNumber to put in an NSArray. Thanks.

I don't know about "proper", but man random. This will at least give you
some ideas.

If you need more detailed control over the generator and distribution functions than the standard C functions give you, you might check out the Random module in Boost. Not too many folks need that level of control, but if you do, check it out:


	<http://www.boost.org>

It's a C++ library, but you could call it with not much trouble using Objective-C++. It's fairly future-proof too, since it's included in TR1 - a technical report from the C++ standards committee concerning what will eventually be the next C++ standard.

sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

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: Random numbers? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Random numbers?
  • Next by Date: [Moderator] Re: Git (and a rant on subversion)
  • Previous by thread: Re: Random numbers?
  • Next by thread: NSPredicate problem: ANY attribute BETWEEN { 1, 10 }
  • Index(es):
    • Date
    • Thread