[JAVA] Número Aleatorio Math.random()


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

Número aleatorio entre a y a + b, excluyendo a + b:
a + Math.random() * b


Copy this code and paste it in your HTML
  1. (int) (Math.random() * 10) // aleatorio entre 0 y 9
  2. 50 + (int) (Math.random() * 50) // aletario entre 50 y 99

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.