Juggles Posted April 16, 2017 Share Posted April 16, 2017 (edited) 51 minutes ago, Final said: I mean we are here to educate him about the use of it, that was a lot of facts which could be found from my original series of posts. Learn what standard deviation is. Read the API Docs on the method: "Generates a random integer based on a normal distribution between 0 and a capped value based on a secret maximum deviation based on the standard deviation." . You now know that the method uses normal distribution, has secret capped value and the value is always 0 or more. This means the positive (right) bound is only used so that negatives are impossible to appear. Use this calculator to see how your numbers are effecting this method: http://davidmlane.com/hyperstat/z_table.html TL;DR: gRandom uses normal distribution to calculate a number, this means we need a mean and an SD for a degree of deviation. The method then only selects from the right bound, we means the selected value can only be larger than the original value. The reason for gRandom being broken is that the method only uses the right side of the possible values, meaning we can't get anything less than the original value. This is good as it is impossible to retrieve negative numbers from the method, however it means that in certain cases such as the example below, we can't access the left bound values, which is an issue in a lot of cases. I believe this was purposely implemented as gRandom in a lot of cases would actually return a negative value, when this value is attempting to impact things such as sleep, you can see why you wouldn't want a negative value in this case. Why not just use something similar to the link you posted then. Mean= 600 SD= 100 lowest value =0 max = infinite 99.7-6 of values would lie between 300-900 with a range of 0-Inf. Adding a max value would also be useful because you wouldn't want a sleep of 100000, even if it's statically unlikely it will eventually occur. I think the method is useful if used and built correctly with a Min and a Max value for example: Mean- 600 SD- 200 Min- 0 Max- 5000 Edited April 16, 2017 by Juggles Link to comment Share on other sites More sharing options...
Final Posted April 16, 2017 Share Posted April 16, 2017 14 minutes ago, Juggles said: Why not just use something similar to the link you posted then. Mean= 600 SD= 100 lowest value =0 max = infinite 99.7-6 of values would lie between 300-900 with a range of 0-Inf. Adding a max value would also be useful because you wouldn't want a sleep of 100000, even if it's statically unlikely it will eventually occur. I think the method is useful if used and built correctly with a Min and a Max value for example: Mean- 600 SD- 200 Min- 0 Max- 5000 I'm not sure, I would have taken a similar approach if i was to create the method. Link to comment Share on other sites More sharing options...
Alek Posted April 16, 2017 Share Posted April 16, 2017 On 4/14/2017 at 9:01 PM, mskod said: Hello, i would like to ask what is the difference between random() and gRandom() and which one should be used? For the love of christ just use random. gRandom doesn't use normal distribution, it uses some custom algorithm which has some flaws. It creates a one-sided normal distribution that forces anything past 3 standard deviations (99.7%) to be set as max deviation. If you don't know what I'm talking about then don't use the method. If you are thinking about "antiban" using something involving gRandom, then you're in for a real long road ahead. Link to comment Share on other sites More sharing options...