Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

floatExp

Public Function
std.Random.floatExp
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.

Params

File

Random.zig:355
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"),
    }
}