Random number generator


/ Published in: Java
Save to your folder(s)

A random number generator using a for-loop.


Copy this code and paste it in your HTML
  1. int randomValue = 0;
  2.  
  3. for (int i = 0; i < 10; i++) {
  4. randomValue = (int) (Math.random() * 10);
  5.  
  6. System.out.println("Random No " + i + ". " + randomValue);
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.