×
Namespaces

Variants
Actions
Revision as of 02:44, 23 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to get a random number from range

From Nokia Developer Wiki
Jump to: navigation, search

This Java ME code snippet shows how to return a random number between a specified maximum and minimum value.

Article Metadata
Article
Created: firt (15 Apr 2007)
Last edited: hamishwillee (23 Jul 2013)
public int getRandomNumber(int min, int max) {
Random rnd;
rnd = new Random();
return min + rnd.nextInt(max - min);
}
This page was last modified on 23 July 2013, at 02:44.
136 page views in the last 30 days.
×