lundi 18 juillet 2022

Java generate random double between exclusive starting range and inclusive ending range

double num = min + Math.random() * (max - min);

This creates random double between [min, max). I would like to create random double between (min, max].

I have seen an approach that generates integers between [min, max], but the number here is integer and the starting range is inclusive.




Aucun commentaire:

Enregistrer un commentaire