funzione random in java

Java
int n = (int) (Math.random() * 51);
Source

Also in Java: