method
Noise.fbm2
Noise.fbm2(x, y, seed, octaves) -> fixed
Samples **fractal Brownian motion** at (x, y): it stacks octaves layers of simplex2, each at double the frequency and half the amplitude of the last, and normalises by the total amplitude so the result stays a fixed in [-1, 1]. Layering this way adds fine detail on top of broad shapes — the standard recipe for natural-looking terrain, clouds, and marble. More octaves means more detail (and more cost); 4–6 is typical.
Each octave uses a different derived seed, and the whole thing is deterministic in fixed point across platforms and runs.
Parameters
seedthe base field selector (each octave derives from it)octaveshow many layers to sum (higher = more detail)Example
program Fbm {
entry {
let seed = 1337
let h = Noise.fbm2(fixed(2) / fixed(7), fixed(9) / fixed(7), seed, 5)
print(Math.floor(Noise.unit(h) * fixed(100))) # detailed 0..100 height
}
}