![]() |
random numbers in java?
I need to generate random numbers in java, and I need them to be completely evenly distributed(or close to that) specifically I need to generate around 300 numbers between 1 and 100...
math random method is not helping, nor any other traditional random method. the problem is the numbers I get from those methods repeat themselves after a certain time, or that they are not evenly distributed(so I get more than half the numbers below 50 and less than half above it...) any ideas? |
Mathematicaly, that's a random number generator:
x 0 = given, x n+1 = P 1 x n + P 2 (mod N) n = 0,1,2,... The parameters P 1, P 2, and N determine the characteristics of the random number generator, and the choice of x 0 (the seed ) determines the particular sequence of random numbers that is generated. In your case N is 101. 2eza ma beddak twajje3 rasak, try this: Quote:
|
thanks, I actually was eventually able to do my code without the need to change the math random thingy, I'll keep your post in mind for future reference though
|
| All times are GMT +1. The time now is 02:57 PM. |
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger