Hi there,
i am using Nokia_7210_MIDP_SDK_v1_0 which doesn't provide the Math.random() method,but i am now writing a Tetrics game MIDlet and need to generate random square.
How can I write my own random() method?Can anyboy help?
Thank you in advance!
Hi there,
i am using Nokia_7210_MIDP_SDK_v1_0 which doesn't provide the Math.random() method,but i am now writing a Tetrics game MIDlet and need to generate random square.
How can I write my own random() method?Can anyboy help?
Thank you in advance!
I think you will find it does .. but not in Math.
Code:import java.util.Random; Random random = new Random(); // --------------------------------------------------------------------- // public static int rand(int scale) { try { return (random.nextInt() << 1 >>> 1) % scale; } catch (Exception e) { return(0); } } // --------------------------------------------------------------------- //