Member Avatar for moha_1990

hey guys this is the question
compile shuffleUniqueRandomNumbers.c and run the exe file to generate n number of random numbers. The program asks for three (3) parameters: generated number, lower bound and output file name. For example if you input 100 as generated number, the program will generate 100 numbers randomly with lower bound as the start number. The result will be saved in a file

is what i did is right ? i dont know ? im doing data structure subject and still dont understand the question
if you could help me. this is what i could reach so far

public class Testing4 {
    private static List<Integer> randomNumber;
    private static Random r = new Random();
    private static int rand;
    private static int endRange = 10000;

    public static void main(String args[]) throws IOException {

        randomNumber = new ArrayList<Integer>();

        for (int i = 1; i<= endRange; i++) {
            rand = r.nextInt(endRange);

            if(randomNumber.contains(rand)) {
                rand = r.nextInt(endRange);
            } else {
                randomNumber.add(rand);
            }

        // Pass the unique random number between 0 and 1000 to this method      
                randomNumberMethod(rand);

        }
    }
}

do you want unique or random? The two are mutually incompatible, when taking random numbers by definition you can't guarantee uniqueness as that places a restriction on the randomness.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.