You are viewing a single comment's thread from:

RE: Seeking help for an easy to extend random function

in #programming6 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

Sort:  

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

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.029
BTC 63135.01
ETH 2546.56
USDT 1.00
SBD 2.64