lundi 8 août 2016

How to make a random number keep regenerating

I am making a program that creates a simulated download. I need the network speed to keep fluctuating between 50 and 60 (Mbps) to make a more realistic simulation. The progress of the download will be shown in the console so I can see how long it might take depending on the variables (file size, and download speed).

This is my code so far:

    Random dRand = new Random();
    int dSpeed = dRand.nextInt(60-50) + 50;      

I have no Idea how to make it keep regenerating in a loop, I already tried a for loop but kept getting stuck.




Aucun commentaire:

Enregistrer un commentaire