Hyper Crusher 4 Share Posted November 7, 2019 This is just a simple utility that offers random numbers within a range, with the option to provide a bias. When working on scripts I prefer to have the bot wait between 600-900ms if an action has been completed or after opening the bank for example, rather than always waiting the same amount of time I like to choose a random number between these. I also prefer to have a bias applied since an even distribution is inhuman in nature and anything that says "I am a bot" is something I would like to avoid. The class can be included anyway in your project, all of the methods are static so you do not need an object instance to call them. All functions return int Unbiased To clarify this is just a wrapper for java.util.Random().nextInt((max - min) + 1 ) + min; Random.nextInt(int min, int max); Lower 'weight' Random.low(int min, int max); Mid-point 'weight' Random.mid(int min, int max); Higher 'weight' Random.high(int min, int max); Custom 'weight' for reference deviation for all functions is 0.3 of the difference of max and min Random.nextGaussian(int min, int max, double deviation, double mean); Data set I ran all functions 20,000 times, and plotted the points on a graph. X-axis is the number generated and the Y axis is the number of times that number showed up Low Bias: Mid-point Bias:High bias Random.java Link to comment Share on other sites More sharing options...
Genii 2 Share Posted November 7, 2019 Weighted random numbers? So not random then Link to comment Share on other sites More sharing options...
Hyper Crusher 4 Author Share Posted November 7, 2019 Eh, still random enough they just have a tendency to be a higher or lower average. It doesn't prevent 99 from being hit on low for example the bias is just a subtle difference to avoid a even average Link to comment Share on other sites More sharing options...
Neffarion 485 Share Posted November 7, 2019 You can also use Gaussian random if bias is what you are seeking. Its probably even more natural // From 300 to 900 with "bias" of 600 Calculations.nextGaussianRandom(600,300); Link to comment Share on other sites More sharing options...
Hyper Crusher 4 Author Share Posted November 7, 2019 On 11/7/2019 at 6:20 AM, Neffarion said: You can also use Gaussian random if bias is what you are seeking. Its probably even more natural // From 300 to 900 with "bias" of 600 Calculations.nextGaussianRandom(600,300); That does work, but I personally prefer being able to set lower, and upper limits if your looking for just a way to ensure a bias towards one number or another it works great though. I want to eventually do it with a Gaussian function, but for some quick goings this is working reasonably enough. I'm new to DreamBot, so I'm still fumbling my way through the API and testing different features Link to comment Share on other sites More sharing options...
Genii 2 Share Posted November 7, 2019 23 minutes ago, HyperCrusher said: Hey cool fresh ideas are always good, keep it up! Link to comment Share on other sites More sharing options...
Hyper Crusher 4 Author Share Posted November 8, 2019 I can't seem to figure out how to edit the main post, (or my reply where I merged my response and the quote, my bad) So here is an update I went ahead and decided that normal distribution was the way to go, so I spent some time working out a deviation and mean that I think worked with what I was trying to go for when I quickly wrote this up main post now reflects this update Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.