Write a program that generates random numbers:
a) Write a method that returns a random integer in the range of 1 to 100.
b) Then add another method that takes a parameter specifying the top number – i.e. if you pass it 50 it returns a random number between 1 and 50. Test your random method and make sure it works.
c) Write another method so that you pass it two values – the top and bottom of the range you want the highest value from – i.e. if you pass it 10 and 20 it returns a random number between 10 and 20.
d) Then write another method so that if repeatedly called it doesn’t return two numbers the same? So once a random number has been generated and returned, the method doesn’t return that number again. To do this you will have to store every number generated.
Do each method in turn and then test that it works by calling it from the main method (I don’t mean write a test plan), again no need for user input. So you should end up with a single class (the main can go in it) with four other methods – each one implementing the functionality described above.
someone help me please