Yin
Junior Member
umm...let me meditate and get my answer...umm
Posts: 21
|
Post by Yin on Nov 26, 2001 23:56:41 GMT -5
boolean firstDirection = random.nextBoolean(); i have this line of code, and when i compile it keeps on telling me: method nextBoolean() not found in class java.util.Random. this error is driving me crazy... anyone else with this problem? does this have something to do with the fact taht i'm using jdk1.3? coz nextInt(int n) won't work either ..but that's fixed.. would it be a better choice if i just choose randomly 0 or 1, then make 0 = vertical and 1 = horizontal? argh~~i'm so lost.... anyways..any help/hint/whine-with-me would be appreciated ;D
|
|
|
Post by Sky on Nov 27, 2001 0:16:02 GMT -5
i am using jdk 1.2.2 and it still works for me but from the error message...i really sounds like u don't have the method in 1.3 not sure anyway
|
|
|
Post by bladehunter on Nov 27, 2001 4:55:50 GMT -5
You might have fixed the problem, but here goes anyways:
About the nextBoolean(), i use jdk 1.3.1 and it still works. By the way u coded it, it seems like u are using Random as a static method or it is something with your initialization of the Random object.
About the way of choosing randomly, there is no one correct way to do it.
|
|
|
Post by gundamf91 on Nov 27, 2001 6:07:48 GMT -5
i just random two number 0,1 so Random r = new Random(); int whatever = r.nextInt(2);
|
|
Yin
Junior Member
umm...let me meditate and get my answer...umm
Posts: 21
|
Post by Yin on Nov 27, 2001 11:37:09 GMT -5
Random random = new Random(); <--this was how i initialized the random object.....did i use a wrong name? i tried compiling it at the cdf lab..and it worked wut's wrong with my computer....(and me)... well..fine..if the nextBoolean method doesn't like me.. then i just won't use it!!!
|
|
|
Post by Majin_Blues on Nov 27, 2001 18:06:56 GMT -5
use it!!!
just at the beginning:
import java.util.*;
|
|