klyn.math.NDArray.random
method
public static random(notnull shape as IList<UInt>) as NDArray<T>
Description

Creates a new NDArray with random values in [0, 1).

Parameters
ParameterDescription
shapeThe shape of the array.
Returns

A new NDArray with random values.

Throws
  • NullException if shape is null at runtime; statically null arguments are rejected with TypeError.
Example
a = NDArray<Double>.random([2ul, 2ul])
print(a)  # Example: [[0.12, 0.98], [0.47, 0.31]]