Function

@rn, @R

Smooth random values: 2D noise sampled at the cell position, so neighbouring cells get similar values. @R is an alias.

Syntax

  • @rn(<max>), @rn(<min>, <max>)
  • @rn(<min>, <max>, <frequency>, <scale>, <octave>)
  • @rn(<min>, <max>, frequency=2, octave=3)
min, max
The output range, with an optional unit. One argument means 0 to that value. Two letters give a letter.
frequency
How fast the noise changes across the grid. Default 1; higher values give smaller features.
scale
Amplitude multiplier. Default 1.
octave
Number of noise layers added together, 1 to 100. More octaves add finer detail. Default 1.

Arguments after the range can be named, in any order: from, to, frequency, scale, octave. The noise field is seeded, so the seed reproduces it. Inside a @m sequence the position of the step is sampled instead of the cell.

Examples

@grid: 20 / 60vmin;
background: hsl(@rn(0, 360), 70%, 60%);
@grid: 20 / 60vmin;
background: #000;
scale: @rn(0, 1, 2);

Higher frequency with more octaves:

@grid: 30 / 60vmin;
background: #000;
opacity: @rn(0, 1, frequency=3, octave=3);

Noise letters:

@grid: 10 / 60vmin;
font-size: .8em;
@content: @rn(a, z, 2);

See also