Hi. A few psuedo-random number generator plugins are already available, but none of them achieve what this plugin can do (AFAIK...). My current project needed this, so I rolled my sleeves up, learned a bit of JavaScript and created my first ever c2 plugin!! Please feel free to use it in your projects; if you make it big as a result then shout out to me and I'll be satisfied.
What does it do? This plugin creates random numbers that conform to non-linear distribution curves. The random(range) expression offers no bias to producing numbers that are near the middle of the range. For example, with a range of 100, 1 is as likely to be returned as is 50. That might fit your needs, but if you want to scatter or spread your random numbers with some bias then this plugin should provide a useful method.
For example - here's a scatter of returned values from a Math.random() expression (x axis = 0 to 1, y axis = frequency, from 50k runs):
And here are a few examples of what can be produced by this plugin:
Demo
Plugin
The plugin is on Github, so feel free to modify / improve etc as you desire. The .js library was obtained from here and a good demo of its speed and versatility can be found here - although not all methods have been implemented because I didn't see the need for some of the distribution patterns.
Distribution options available (% figures are speed of execution compared to Math.random):
1 Precision Normal Distribution - Gaussian distribution (20%)
2 Precision Custom Loaded - High Quality (20%)
3 Range Float - Uniformly distributed numbers in range (like random()) (90%)
4 Range Integer - Uniformly distributed integers (inclusive) (70%)
5 Range Loaded - Middle/End loaded numbers in range (30%)
6 Game Normal - Normal shaped game distribution (30%)
7 Game Spire - Spire shaped game distribution (50%)
8 Game Thorn - Thorn shaped game distribution (30%)
9 Game Trapezoid - Trapezoid game distribution (50%)
10 Game Bowl - Bowl shaped game distribution (50%)
11 Game Wedge - Wedge shaped game distribution (30%)
12 Game Teat - Teat shaped game distribution (30%)
Thanks.