Sign in to follow this  

nextFloat() method undefined?

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
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

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

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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