I need to randomly pick 10 numbers from 1 to 2000. It is very important that this rng cannot be predicted/hacked in any way. Would this be a safe/proper way to do it:
int randomInt;
SecureRandom random = new SecureRandom();
for (int i = 1; i <= 10; i++)
{
randomInt = random.nextInt(2000) + 1;
String generated = generated+String.valueOf(randomInt)+",";
}
I need it to securely generate those random numbers both on windows and android devices. The devices can be offline too if it helps. So would this be safe?
EDIT: I'm especially worried about android version, because I've heard bad stories in the past where people got hacked due to a bug with SecureRandom on android.