stream_perlin v0.1.0 StreamPerlin
Generate a potentially infinite stream of floats betyween -1 and 1 which vary smoothly using a 1d Perlin algorithm.
Summary
Functions
Return a stream of random-ish floats between -1 and 1, where the values tend to change smoothly. This is useful when generating data that is supposed to look natural
Functions
Return a stream of random-ish floats between -1 and 1, where the values tend to change smoothly. This is useful when generating data that is supposed to look natural.
Usage
StreamPerlin.generate(n)
generates a stream of floats. n
is the frequency, a positive integer.
It determines the number of values that are interpolated between new
random points. The interpolation is eased using a quintic with zero first and
second derivatives at 0 and 1, ensuring the curve is continuous and smooth
as it moves between random values.
Good values of n
depend on how jagged you want your data, and how many samples
you typically take. Values between 5 and 20 seem like a good starting
point.
If you need more complex data, you can apply Perlin’s octaves technique.