Sign in to follow this  
LordShade

nextFloat() method undefined?

Recommended Posts

LordShade    251
Working with the J2ME Sun Emulator and am getting this error:
C:\DevTools\WTK22\apps\DarkWar\src\CDWPilot.java:43: cannot find symbol
symbol  : method nextFloat()
location: class java.util.Random
        float fRnd = rnd.nextFloat();
Here's the code basically:
Random rnd = new Random();
Date date = new Date();
long lTime = date.getTime();
        
rnd.setSeed(lTime);
float fRnd = rnd.nextFloat();
any clues? Thanx for the help.

Share this post


Link to post
Share on other sites
nmi    978
In latter versions (of CLDC) it is, as you can read in the link i posted.
But since MIDP 2.0 only requires CLDC 1.0 there probably won't be floating point support on most systems. And this may also be the reason for the error.

Share this post


Link to post
Share on other sites
shmoove    821
If you're using the Wireless Toolkit then you can set the CLDC version your project should use from the Project Settings dialog in the "API Selection" tab.

shmoove

Share this post


Link to post
Share on other sites
_nomad_    100

latter nokia phones are cldc 1.1, i believe...i previously was compiling the .jar file as cldc 1.1 (unknowingly, i thought it was 1.0), and suddenly, it wouldn't install in one of the nokia test phones (forgot the model name, but it's series 60). :)

but it'd still be better to use one of the floating point libraries out there. i think. :)

Share this post


Link to post
Share on other sites
LordShade    251
The joy of learning a new platform. :) Read something but then get excitied about something else and forget about what you read before. hehe

Thanx for the heads up.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this