Noise functions are a way to produce continuous pseudorandom values across one or more dimensions. The simplest example is a one-dimensional noise function that makes the y-value wobble up and down smoothly, but unpredictably as you move along the x-axis. It’s also possible to produce 2-dimensional noise, where the amplitude of the noise depends on […]

## Meandering Triangles

Contour lines, also known as isolines, are lines drawn along along paths of constant elevation. They are often used when drawing maps to indicate the slope of hills and mountains: But they can also be used to visualize functions that map (x,y) values to z values, or to find the boundaries of implicit surfaces. One […]

## A Faster Weighted Random Choice

Consider this problem: You have a list of items and a list of their weights. You want to randomly choose an item, with probability proportional to the item’s weight. For these examples, the algorithms will take a list of weights and return the index of the randomly selected item. Linear Scan The simplest algorithm works […]