How to generate cryptographically random numbers?

How can I generate a certain amount of random numbers in java.?

  • I'm trying to write a program where the user enters a number and the program will generate that many random numbers. For example the user enters 5 and the program shows 1,9,5,7,6. I have so far: Scanner input = new Scanner(System.in); System.out.print("Enter n: "); int n = input.nextInt(); *****This is where I'm stuck because I'm not sure how to use whatever number the user enters and have the program generate that many random numbers. If you could help me out that would be great and if you could explain I would appreciate it. There's another part to this program but I'm pretty sure I know how to write it.

  • Answer:

    use a "for" loop. in each loop, generate a random number, and display it to the screen. gl.

Jay-R R at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

use do while loop

Karthik Kumar Musalay

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.