Random Integer in J2ME

Saturday, 23 May 2009, 755

import java.util.Random;
:
Random random=new Random();
int rand=Math.abs(random.nextInt()% Big Number);
:

Big Number is the upper limit of the random value. Sample:

import java.util.Random;
:
Random random=new Random();
int renk=Math.abs(random.nextInt()%9999);
:


Leave a comment
Name(required)
Mail (will not be publishing) (required)
Website