std.Random.array
pub fn array(r: Random, comptime E: type, comptime N: usize) [N]E
- Kind
- function
- Module
std.Random
Source: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
The entries of std.Random in the Zig reference. This page has 37 cards.
pub fn array(r: Random, comptime E: type, comptime N: usize) [N]E
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn boolean(r: Random) bool
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn bytes(r: Random, buf: []u8) void
Read random bytes into the specified buffer until full.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Cryptographically secure random numbers.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
Fast unbiased random numbers.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn enumValue(r: Random, comptime EnumType: type) EnumType
Returns a random value from an enum, evenly distributed.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: type) EnumType
Returns a random value from an enum, evenly distributed.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn float(r: Random, comptime T: type) T
Return a floating point value evenly distributed in the range [0, 1).
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn floatExp(r: Random, comptime T: type) T
Return an exponentially distributed float with a rate parameter of 1.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn floatNorm(r: Random, comptime T: type) T
Return a floating point value normally distributed with mean = 0, stddev = 1.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn int(r: Random, comptime T: type) T
Returns a random int `i` such that `minInt(T) <= i <= maxInt(T)`. `i` is evenly distributed.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T
Returns an evenly distributed random integer `at_least <= i <= at_most`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T) T
Constant-time implementation off `intRangeAtMostBiased`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T) T
Returns an evenly distributed random integer `at_least <= i < less_than`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_than: T) T
Constant-time implementation off `intRangeLessThan`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn interface(this: *const @This()) std.Random
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn limitRangeBiased(comptime T: type, random_int: T, less_than: T) T
Convert a random integer 0 <= random_int <= maxValue(T), into an integer 0 <= result < less_than.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shuffle(r: Random, comptime T: type, buf: []T) void
Shuffle a slice into a random order.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn shuffleWithIndex(r: Random, comptime T: type, buf: []T, comptime Index: type) void
Shuffle a slice into a random order, using an index of a specified type to maintain distribution across targets.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn uintAtMost(r: Random, comptime T: type, at_most: T) T
Returns an evenly distributed random unsigned integer `0 <= i <= at_most`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn uintAtMostBiased(r: Random, comptime T: type, at_most: T) T
Constant-time implementation off `uintAtMost`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn uintLessThan(r: Random, comptime T: type, less_than: T) T
Returns an evenly distributed random unsigned integer `0 <= i < less_than`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn uintLessThanBiased(r: Random, comptime T: type, less_than: T) T
Constant-time implementation off `uintLessThan`.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize
Randomly selects an index into `proportions`, where the likelihood of each index is weighted by that proportion.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.
std.RandomSource: codeberg.org, ziglang.org. JSON record. This entry is a card. Help write this page.