Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > method for randomly selecting boolean value

Reply
Thread Tools

method for randomly selecting boolean value

 
 
Anand
Guest
Posts: n/a
 
      03-09-2007
hi plz tell me how to code a method that will randomly pick boolean
value 0 or 1

 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      03-09-2007
Anand wrote On 03/09/07 17:27,:
> hi plz tell me how to code a method that will randomly pick boolean
> value 0 or 1


Not possible: The only boolean values are true and false.

If you can modify the requirements a little, though, you
might be able to generate boolean values by using Math.rand()
and a comparison, or by using java.util.Random#nextBoolean().
It's astonishing what you can find in the JavaDoc, once you
take the dreaded step of consulting it.

--
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
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
Subtle difference between boolean value and boolean comparison? Metre Meter Javascript 7 08-06-2010 08:40 PM
difference between 'boolean' and 'java.lang.Boolean' J Leonard Java 4 01-19-2008 02:56 AM
Randomly selecting an element from an STL collection Generic Usenet Account C++ 9 07-01-2007 09:55 AM
method for randomly selecting boolean value Anand Java 5 03-10-2007 09:48 PM
WIFI connection randomly/non randomly disconnects King Fu Wireless Networking 2 11-10-2004 07:03 AM



Advertisments