pub fn floatExp(r: Random, comptime T: type) T
Return an exponentially distributed float with a rate parameter of 1.
To use a different rate parameter, use: floatExp(...) / desiredRate.
r: Random
T: type
355 356 357 358 359 360 361 362
pub fn floatExp(r: Random, comptime T: type) T { const value = ziggurat.next_f64(r, ziggurat.ExpDist); switch (T) { f32 => return @floatCast(value), f64 => return value, else => @compileError("unknown floating point type"), } }
Return an exponentially distributed float with a rate parameter of 1.
To use a different rate parameter, use: floatExp(...) / desiredRate.