Espero me puedan ayudar con una duda.
Estoy explorando la programacion en java para moviles,encontre un ejercicio de numeros aleatorios pero me manda error
Código:
me manda error en " float f = number.nextFloat(); "import java.util.Random; public class Random extends MIDlet implements CommandListener{ private Display display; private Command exit, generate; private StringItem item; private Form form; public Random(){ display=Display.getDisplay(this); form = new Form("RandomNumber"); exit = new Command("Exit", Command.EXIT,0); generate = new Command("Generate", Command.OK,1); item = new StringItem("Number ",""); form.addCommand(exit); form.addCommand(generate); form.setCommandListener(this); form.append("This Random Number Generated By Mr. Sandeep Kumar Suman, Software Developer, Roseindia Technology Pvt Ltd. Mobile No:+919313985248"); form.append(item); } public void startApp(){ display.setCurrent(form); } public void pauseApp(){} public void destroyApp(boolean unconditional){ notifyDestroyed(); } public void commandAction(Command c, Displayable d){ String label = c.getLabel(); if(label.equals("Exit")){ destroyApp(false); }else if(label.equals("Generate")){ Random(); } } public void Random(){ Random number = new Random(); float f = number.nextFloat(); number.setSeed(System.currentTimeMillis()); item.setText(""+(f*100.0f)%100); } }
"number.setSeed(System.currentTimeMillis());"
Espero me puedan orientar.
si no es la seccion correcta un disculpa...