How to generate only positive numbers in JAVA

0 votes
140 views
asked Dec 3, 2013 in JAVA by mats Moreau
HI

  How to generate only positive numbers in JAVA?

1 Answer

0 votes
answered Dec 3, 2013 by Josh
int answer = Math.abs(r.nextInt()%101);
...