CheckingItOut Posted July 17, 2021 Share Posted July 17, 2021 Hi, I'm trying to do what the title talks about. Currently I have public final class Range extends Script { long start = System.currentTimeMillis(); long end = start + 5*random(50,60)*random(60)*random(1000); // 60 seconds * 1000 ms/sec Then in my onLoop method, I have if (System.currentTimeMillis() > end) { stop()}. I'm trying to have the script shut down after a random amount of time between 5 and 6 hours. It shut off after less than 1 hour though, am I converting my values incorrectly? Quote Link to comment Share on other sites More sharing options...
Nbacon Posted July 18, 2021 Share Posted July 18, 2021 random(60)*random(1000) ... you are using 2 random vars for things that are units.... this should work ... random(5*60,6*60)*60*1000; Quote Link to comment Share on other sites More sharing options...