RE: Seeking help for an easy to extend random function

You are viewing a single comment's thread from:

Seeking help for an easy to extend random function

in programming •  7 years ago 

And what if you do the same thing in java having almost built in fuctions for random numbers picking where you just put your priority e.g

Random().nextInt(int bound) generates a random integer from 0 (inclusive) to bound (exclusive)

If you give the function
private static int getRandomNumberInRange(int min, int max)

private static int getRandomNumberInRange(0, 6) it will generate random numbers between 0 and 6

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Getting the random number within a range is not the problem, that is basically what rand(min,max) does.
My problem is to get a number whit a certain chance ;)

so you can set priorities in java with the help of threading