File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java Micro Edition
generating random numbers
Joined: Dec 01, 2004
Feb 05, 2005 01:18:00
how can i generate a random number between specific range, say for example between 1-5??
Teach me to die that so I may<br />Rise glorious at the awful day
Joined: Sep 13, 2003
Feb 05, 2005 13:48:00
You can use
Random rGen = new Random(); int r = rGen.nextInt(); r = 1 + r % 4; // where 1 is the start of your interval // and 4 is the end of the interval minus the start (5-1)
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: generating random numbers
WA #1.....word association
Generating Random Number
(IN) PREDICATE in sql
Marcus Green Tutorial
diffrences between Random methods...
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015