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

floatNorm

Public Function
std.Random.floatNorm
pub fn floatNorm(r: Random, comptime T: type) T

Return a floating point value normally distributed with mean = 0, stddev = 1.

To use different parameters, use: floatNorm(...) * desiredStddev + desiredMean.

Params

File

Random.zig:343
343
344
345
346
347
348
349
350
pub fn floatNorm(r: Random, comptime T: type) T {
    const value = ziggurat.next_f64(r, ziggurat.NormDist);
    switch (T) {
        f32 => return @floatCast(value),
        f64 => return value,
        else => @compileError("unknown floating point type"),
    }
}