Search:

Type: Posts; User: ojonugwa

Search: Search took 0.10 seconds.

  1. Re: Generating random numbers in java without repeating a specific number

    cool.

    --- Update ---

    Found a solution (?) to the problem.


    ...
    ArrayList <Integer> numbers = new ArrayList<Integer>();
    int position=0;
  2. Re: Generating random numbers in java without repeating a specific number

    I have found that this is the case.
  3. Re: Generating random numbers in java without repeating a specific number

    :o Okay.I'll get right to it.

    --- Update ---

    Ok so am working using Sets now (for the first time) and i discovered it does not allow duplicates which is good.but problem is,when i run the code...
  4. Re: Generating random numbers in java without repeating a specific number

    Thanks.I have moved away from this problem as i now understand i cannot prevent the random number generator from generating a specific number twice.
  5. Generating random numbers in java without repeating a specific number

    Let say i have this code:


    public class MyRandomStuff {
    public static void main (String[]args) {

    int [] randomNumbers = new int[5];

    for (int i=0; i<randomNumbers.length; i++) {
    ...
Results 1 to 5 of 5