Skip to main content
gamedev.net
🔒 Locked

nextFloat() method undefined?

Started by LordShade 5 replies 2.1k views
Original Post
LordShade
LordShade
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.
_nomad_
_nomad_
isn't it supported in the latter version of cldc? (i think 1.1?)

nmi
nmi
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.
shmoove
shmoove
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
_nomad_
_nomad_

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. :)
LordShade
LordShade
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.