Ranging random integers not found in java.util.Random
An example on generating random integers between a specified range.
Example
Output
If you want to include start i.e. you want to allow even value of start (here 10) to come, then you must change if(k>start) to if(k>=start)
If you don't wish to write the logic, you can see my example on my class gowtham.gutha.util.RandomRangeInteger, download the java-utils framework (for using the class).
No comments:
Post a Comment