# Um... is this new?

This forum is currently in read-only mode.
• Check under the system expressions for math you'll find this:

Normal distribution random

Pretty sure I haven't seen that one before.

So what exactly is its usage, I mean besides a random generator. I get mean, but sigma???

NormalRandom(mean, sigma)

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Stolen pic from wikipedia:

click for image (didn't embed properly)

Basically, it generates a random number with that kind of distribution. mean = peak, sigma is proportional to the width of the bell shape, and numbers are more likely to be generated where the graph is higher. Note it goes off infinitely in either direction so in theory it could generate any number no matter the mean and sigma, but most of those values would be nigh on impossible. You can always clamp the output for a certain range.

• Can I get an example, cause as usual I'm doing it wrong.

System: Always (every tick)

SystemCreate object Sprite 0 on layer 1 at (NormalRandom(300, 100), NormalRandom(200, 50))

TextSet text to NormalRandom(300, 100)

• This might be useful, despite thread necromancy from 2008.

Sigma is the Standard Deviation for a Normal curve. For any given normal curve (shown in that linked picture above) there is a standard deviation where ~34% either side of the mean (peak) will fall.

Normal random vs ... typical random.

If you drew a normal random from 100, you are equally as likely to get 2 or 98 (each is 1/100 chance) as you are to get 45, 50, 60, 73 etc. With a normal curve, the further you are from the mean (50), the lower the chance of that number appearing. So, 2 or 98 will occur very infrequently (~1%) and most results will land around the 50 mark. If your sigma is larger, then the curve is flatter and in the 1-100 example, there will be a greater chance to get numbers between 30 and 70.

This is a really cool feature, although I haven't actually found a use for it yet.

• Actually since your output can range from positive to negative, unlike the regular random, I found its quite useful for generating a random sinus curve.

With that you can make a ai type movement that is limited to a set of certain x, or y coords on the screen without using clamp.

• Perhaps I'm missing something, but I cannot find the command NormalRandom anywhere. Is it out of the program perhaps?