Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > random number generator

Reply
Thread Tools

random number generator

 
 
iandigges@gmail.com
Guest
Posts: n/a
 
      04-25-2007
I need a random number generator to produce a 0 or 1 that I can feed
into a multidimensional array. Any hints?

~ Ian

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      04-25-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I need a random number generator to produce a 0 or 1 that I can feed
> into a multidimensional array. Any hints?


int rand_bit()
{
return rand() > RAND_MAX / 2;
}

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
Zeppe
Guest
Posts: n/a
 
      04-25-2007
(E-Mail Removed) wrote:
> I need a random number generator to produce a 0 or 1 that I can feed
> into a multidimensional array. Any hints?
>


use the rand() of the standard library.

Regards,

Zeppe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random Number Generator?? Kingsley Oteng VHDL 11 08-09-2010 10:00 AM
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Random number generator, generating 10 different numbers. Need Help. Wally ASP .Net 1 03-20-2006 12:19 AM
Random number/letter generator tshad ASP .Net 3 05-06-2005 06:15 PM



Advertisments