I want to generate random numbers . Now, I want to generate a new set of random numbers in a way that that increases the probability of returning the numbers that were generated earlier.What is the best way of achieving this ?
            Asked
            
        
        
            Active
            
        
            Viewed 487 times
        
    -2
            
            
        - 
                    1If you use the same seed for the random number generator it will generate the same sequence of numbers. – Henry Jul 04 '14 at 06:37
- 
                    This may be the answer... http://stackoverflow.com/questions/12458383/java-random-numbers-using-a-seed – Jakub Jul 04 '14 at 06:38
2 Answers
1
            
            
        I dont know if predefined functions exist or not, but I have something in mind that you can try.
- Make an ArrayList of the numbers. (eg. if you want to generate from 0to30, then make an ArrayList of Integers from 0 to 30).
- Shuffle the ArrayList(Collections.shuffle())
- Pick the first 2 numbers.
- Then, just add those 2 numbers into the ArrayList as many times as you want the probablity to shift towards them.
- Shuffle again and pick
 
    
    
        harveyslash
        
- 5,906
- 12
- 58
- 111
0
            
            
        You can store that values on array. And you can have a random condition also for having a new pair of number or pick randomly on your array.
 
    
    
        bumbumpaw
        
- 2,522
- 1
- 24
- 54
