MCPcopy Create free account
hub / github.com/VCVRack/Rack / randomize

Method randomize

src/engine/ParamQuantity.cpp:155–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154
155void ParamQuantity::randomize() {
156 if (!isBounded())
157 return;
158
159 if (snapEnabled) {
160 // Randomize inclusive of the maximum value
161 float value = math::rescale(random::uniform(), 0.f, 1.f, getMinValue(), getMaxValue() + 1.f);
162 value = std::floor(value);
163 setImmediateValue(value);
164 }
165 else {
166 // Same as Quantity::randomize() but with setImmediateValue()
167 setImmediateValue(fromScaled(random::uniform()));
168 }
169}
170
171
172std::string ParamQuantity::getDescription() {

Callers 1

onRandomizeMethod · 0.45

Calls 3

uniformFunction · 0.85
floorFunction · 0.85
rescaleFunction · 0.50

Tested by

no test coverage detected