I am trying to create a random number that fills a certain percentage of the time. For example, I want to create an array that is set between a certain range (say, 0-100), but in 10% of the cases I want a random number selected to be multiplied by n. How can I create this "random" number n% of the time?
edit I have not tried this in Java yet, I was only trying to write out the algorithm manually, but I just got stuck. What I will have is a variable that contains a number, let's say that the number is 3000, and a random number from the array will be subtracted from the number 3000 until it reaches 0, but a certain percentage of the time I want the number output from the array multiplied by a certain percentage of the time.
source share