lundi 28 décembre 2020

Random generate a year within a range

Ive got this java class where I want to randomly generate a year between 2020 and 2022 using random class .I know the code below wont do the trick so can you please help me

Random random = new Random();

int year=random.nextInt(2022-2020 +1);




Aucun commentaire:

Enregistrer un commentaire