981815 wrote:
I wanna to generate numbers -in range- with equal probability*.
First off, there is no such thing as random numbers with equal probability--all random numbers in the computer world are called pseudo random numbers because they are all generated and follow a patter set forth by their algorithm. They will all have peeks and valleys in their distribution, but the best of them are near equal over extreamly long test cases. That does not mean that you couldn't ask for a random number and get a number, say 5, back 1000 times in a row; it's not very probable, but it could happen.
As stated in previos posts, the Random Class is what you are looking for, it you are not motivated enough to study it over, then you really do not need a solution that bad.
It appears that you are looking for whole numbers: you can guarentee that you do not get a repeat from your custom programmed random number method by hashing to the next open number in your range. You'll have to track each number as it is given from he Random object and hash to the next open if it has already been used.
In any case, we are glad to offer assistance in your leaning, but not provide ready made solutions for you.