Klang C++ 0.7.15
Language Reference (draft)
Loading...
Searching...
No Matches
random

Language Guide / Functions · Generated API signature

random

klang::random

Returns a pseudorandom value or sets the seed.

Returns a pseudorandom value between the supplied endpoints. Floating-point endpoints give a range of fractional values. A call with a single seed during setup can make the sequence repeatable. In a signal chain, generate the value first and route the result to its destination.

Uses the C library’s rand and srand.

Direct call

const auto detune = random(-0.02, 0.02);

Route the result

signal detune;
random(-0.02, 0.02) >> detune;