jeudi 17 septembre 2020

How to generate randoms numbers between a specified range e.g (6,10) in java [duplicate]

I just learning Java and I'm trying to generate random numbers between a specified range (6,10), I have tried using RandomSecure()

Here's a sample of my code

SecureRandom randomGen = new SecureRandom();
randomGEn.nextInt(6,10);

and this is the complier's error message

error: no suitable method found for nextInt(int,int)

but with the error message I got, it is pretty obvious that SecureRandom can't help me achieve what I want. pls, how do I achieve this?




Aucun commentaire:

Enregistrer un commentaire