Jump to content
  • Advertisement
Sign in to follow this  
LordShade

nextFloat() method undefined?

This topic is 4856 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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!