Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

java program

Thu Nov 08, 2012 11:13 am

c. Write an efficient Program to print the following two outputs.
You are given a pre-defined function named getrnd50() which returns an integer which is one random number from 1-50. You can call this function as many times as you want but beware that this function is quite resource intensive. You cannot use any other random generator. You can NOT change the definition of getrnd50().

int getrnd50(){
Random rand = new Random();
return (1+rand.nextInt(50));
}

Output1: Print numbers 1-10 in random order. (Not 10 random numbers)
Output2: Print numbers 1-100 in random order. (Not 100 random numbers)

Note:
i. Every number should be printed exactly once.
ii. There should be no pattern in the numbers listing. List should be completely random i.e., all numbers have equal probability appearing at any place.
iii. You may call getrnd50() any number of time to get random number from 1 to 50.
iv. You cannot use any other random generator function except getrnd50().



Re: java program

Thu Nov 08, 2012 4:38 pm

Dear Bro,
this looks an assignment , you have to start coding and if u faced a problem, just post the code and we will help u.

Post a reply
  Related Posts  to : java program
 java program     -  
 email through JAVA program     -  
 java chat program.     -  
 compiling and getting of a java program     -  
 Executing a Java Program     -  
 Elements of a Java Program     -  
 Java Chat Program between two computers     -  
 Need Java program for display the CPU usage     -  
 Java Program for communicate PC and Mobile     -  
 uploading text file to java program     -