rand#

swordfish.function.rand()#

Return a random scalar/vector/matrix of the same data type as X.

  • If X is a scalar, X must be a positive numerical value. Random values are generated following a uniform distribution on [0, X).

  • If X is a vector, random values are drawn from the elements of X.

参数:
  • X (Constant) -- A scalar/vector.

  • count (Constant, optional) --

    An INT scalar/pair.

    • If count is not specified, a scalar is returned.

    • If count is a scalar, it specifies the length of the output vector.

    • If count is a tuple, it specifies the dimensions of the output matrix.