Posted By

The_Englishman on 05/02/07


Tagged

number random generate


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

The_Englishman
bsteadman


generateNumber


 / Published in: Java
 

  1. /**
  2. * For generating a random number, from 0 to max
  3. */
  4. public static int generateNumber(int max)
  5. {
  6. return (int)( Math.ceil(Math.random() * max ) - 1) ;
  7. }

Report this snippet  

You need to login to post a comment.