Patterns in Randomness

Today I saw a Reel talking about the Central Limit Theorem.

In probability theory, the central limit theorem (CLT) states that, under appropriate conditions, the distribution of a normalized version of the sample mean converges to a standard normal distribution.

My project is a simple visualizer of this theory. A line graph is drawn, and several points are placed at the center. For every tick, each point can either move left, right, or stay on the line graph. After several ticks, a curve is drawn. You’ll notice that every time you run the project, the curve looks almost the same. The data is very predictable. Even though the points move at random, you still get almost the same result every time.

Common applications of the Central Limit Theorem include surveys, risk management, quality control predictions, and much more.

Yellow line is the calculated bell curve for the random data.
Red line is for perfect bell curve (not random).

If you click the stage before running the project or after the simulation runs, you can change some of the parameters.

  • Axis range: Length of the line graph.
    • Example: a value of 10 makes the line graph 21 spaces long, -10 to 10
  • Movements per trial: How many times each point can move left, right, or stay.
    • Example: a value of 4 could make a point randomly move left, left, right, stay, or right, left, right, left, or stay, stay, stay, left, etc.
  • Sample size: How many points are placed on the graph.
    • Example: a value of 40 would place 40 points on the graph.
  • Animation time: How long it takes for the movement animations to complete. Doesn’t affect calculations, just how they’re presented.

Nice!

I came back to work on this a little bit

  • Added a perfect curve to demonstrate how far off the random data is
  • New animation time slider in settings to speed up or slow down the movement of the dots

TODO:

  • Calculate % accuracy

update

  • added some animations
  • added error data
  • you can now export images (with transparent background) of a graph by downloading the costume inside the Export sprite

bug: safari sucks and does weird things
i don’t feel like fixing it right now

i (think) i fixed this
the stage capture would take a lower resolution snapshot on safari for some reason so i made it resize based on how big the snapshot is

also fixed some other bugs with animations and pen