Skip to content

Randomness

[Source]

Source of randomness, providing methods for generatic uniformly distributed values from a given closed interval: [min, max] in order for the user to be able to generate every possible value for a given primitive numeric type.

All primitive number method create numbers in range [min, max)

class ref Randomness

Constructors

create

[Source]

new ref create(
  seed1: U64 val = 42,
  seed2: U64 val = 0)
: Randomness ref^

Parameters

  • seed1: U64 val = 42
  • seed2: U64 val = 0

Returns


Public Functions

u8

[Source]

generates a U8 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref u8(
  min: U8 val = call,
  max: U8 val = call)
: U8 val

Parameters

  • min: U8 val = call
  • max: U8 val = call

Returns


u16

[Source]

generates a U16 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref u16(
  min: U16 val = call,
  max: U16 val = call)
: U16 val

Parameters

  • min: U16 val = call
  • max: U16 val = call

Returns


u32

[Source]

generates a U32 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref u32(
  min: U32 val = call,
  max: U32 val = call)
: U32 val

Parameters

  • min: U32 val = call
  • max: U32 val = call

Returns


u64

[Source]

generates a U64 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref u64(
  min: U64 val = call,
  max: U64 val = call)
: U64 val

Parameters

  • min: U64 val = call
  • max: U64 val = call

Returns


u128

[Source]

generates a U128 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref u128(
  min: U128 val = call,
  max: U128 val = call)
: U128 val

Parameters

  • min: U128 val = call
  • max: U128 val = call

Returns


ulong

[Source]

generates a ULong in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref ulong(
  min: ULong val = call,
  max: ULong val = call)
: ULong val

Parameters

Returns


usize

[Source]

generates a USize in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref usize(
  min: USize val = call,
  max: USize val = call)
: USize val

Parameters

Returns


i8

[Source]

generates a I8 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref i8(
  min: I8 val = call,
  max: I8 val = call)
: I8 val

Parameters

  • min: I8 val = call
  • max: I8 val = call

Returns


i16

[Source]

generates a I16 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref i16(
  min: I16 val = call,
  max: I16 val = call)
: I16 val

Parameters

  • min: I16 val = call
  • max: I16 val = call

Returns


i32

[Source]

generates a I32 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref i32(
  min: I32 val = call,
  max: I32 val = call)
: I32 val

Parameters

  • min: I32 val = call
  • max: I32 val = call

Returns


i64

[Source]

generates a I64 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref i64(
  min: I64 val = call,
  max: I64 val = call)
: I64 val

Parameters

  • min: I64 val = call
  • max: I64 val = call

Returns


i128

[Source]

generates a I128 in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref i128(
  min: I128 val = call,
  max: I128 val = call)
: I128 val

Parameters

  • min: I128 val = call
  • max: I128 val = call

Returns


ilong

[Source]

generates a ILong in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref ilong(
  min: ILong val = call,
  max: ILong val = call)
: ILong val

Parameters

Returns


isize

[Source]

generates a ISize in closed interval [min, max] (default: [min_value, max_value])

behavior is undefined if min > max.

fun ref isize(
  min: ISize val = call,
  max: ISize val = call)
: ISize val

Parameters

Returns


f32

[Source]

generates a F32 in closed interval [min, max] (default: [0.0, 1.0])

fun ref f32(
  min: F32 val = 0.0,
  max: F32 val = 1.0)
: F32 val

Parameters

  • min: F32 val = 0.0
  • max: F32 val = 1.0

Returns


f64

[Source]

generates a F64 in closed interval [min, max] (default: [0.0, 1.0])

fun ref f64(
  min: F64 val = 0.0,
  max: F64 val = 1.0)
: F64 val

Parameters

  • min: F64 val = 0.0
  • max: F64 val = 1.0

Returns


bool

[Source]

generates a random Bool value

fun ref bool()
: Bool val

Returns


shuffle[T: T]

[Source]

fun ref shuffle[T: T](
  array: Array[T] ref)
: None val

Parameters

Returns