P5 Python Docs
  • Getting Started
  • Simple mode
  • Reference
    • Shapes
      • 2D
        • point()
        • line()
        • rect()
        • square()
        • triangle()
        • circle()
        • ellipse()
        • arc()
        • quad()
        • beginShape()
      • 3D
        • plane()
        • box()
        • sphere()
        • cone()
        • cylinder()
        • ellipsoid()
        • torus()
    • Controlling the environment
      • coordinateMode()
      • rectMode()
      • ellipseMode()
      • frameRate()
      • setup()
      • draw()
    • Built-in Variables
      • Environment
      • Keyboard
      • Mouse
    • Built-in Functions
      • keyIsDown()
      • millis()
      • second()
      • minute()
      • hour()
      • translate()
      • rotate()
      • createSlider()
      • createGraphics()
      • createVector()
    • Events
      • Keyboard
        • keyPressed()
        • keyReleased()
      • Mouse
        • mouseMoved()
        • mouseDragged()
        • mousePressed()
        • doubleClicked()
        • mouseWheel()
    • Text
      • text()
      • textSize()
      • textAlign()
    • Math
      • drawTickAxes()
      • random()
      • randomGaussian()
      • dist()
      • linmap()
      • bounce()
      • wave()
    • Colour and Outline
      • colorMode()
      • fill()
      • stroke()
      • strokeWeight()
      • background()
    • Images & Audio
      • loadImage() and image()
      • loadSound()
    • 3D Controls
      • orbitControl()
      • translate()
      • rotateZ()
      • rotateX()
      • rotateY()
      • scale()
Powered by GitBook
On this page
  • Example
  • Syntax
  • Description
  1. Reference
  2. Math

randomGaussian()

Generate a random number based on a Gaussian probablity distribution

Previousrandom()Nextdist()

Last updated 2 years ago

Example

    circle(randomGaussian(150, 15), randomGaussian(150, 15), 25)

Syntax

randomGaussian([mean], [std])
Input
Description

mean

the mean of the distribution

std

the standard deviation of the distribution

    circle(randomGaussian(150, 50), randomGaussian(150, 50), 25)a

Description

This function picks a random value from a gaussian distribution of a specified mean µ and standard deviation σ. The gaussian distribution prefers those points around the mean more that others. The farther the point is from the mean the less likely it is to be picked. But how far? the standard deviation parameter specifies that.

f(x)=1σ2π e−12(x−μσ)2f(x) =\frac 1 {\sigma \sqrt {2\pi}}\ e^{-\frac 1 2 (\frac {x-\mu} {\sigma})^2}f(x)=σ2π​1​ e−21​(σx−μ​)2

Find these documents helpful? Let the people who made them help your child learn to code at !

We'd love to hear your Feedback/Comments .

Strivemath
here