Skip to content

rand.config #

struct NormalConfigStruct #

struct NormalConfigStruct {
	mu    f64 = 0.0
	sigma f64 = 1.0

Configuration struct for generating normally distributed floats. The default value for mu is 0 and the default value for sigma is 1.

struct PRNGConfigStruct #

struct PRNGConfigStruct {
	seed_ []u32 = seed.time_seed_array(2)

PRNGConfigStruct is a configuration struct for creating a new instance of the default RNG. Note that the RNGs may have a different number of u32s required for seeding. The default generator WyRand used 64 bits, ie. 2 u32s so that is the default. In case your desired generator uses a different number of u32s, use the seed.time_seed_array() method with the correct number of u32s.

struct ShuffleConfigStruct #

struct ShuffleConfigStruct {
	start int
	end   int

Configuration struct for the shuffle functions. The start index is inclusive and the end index is exclusive. Set the end to 0 to shuffle until the end of the array.

fn (ShuffleConfigStruct) validate_for #

fn (config ShuffleConfigStruct) validate_for[T](a []T) !

validate_for is a helper function for validating the configuration struct for the given array.