CMQ c'è una fonzione in java che restituisce un numero casuale:

Math.random()