Function rc_matrix_random#
Defined in File matrix.h
Function Documentation#
-
int rc_matrix_random(rc_matrix_t *A, int rows, int cols)#
Generates a matrix populated with random numbers between -1 and 1.
Resizes A to be a matrix with the specified number of rows and columns and populates the new memory with random numbers evenly distributed between -1.0 and 1.0. Any existing memory allocated for A is freed if necessary to avoid memory leaks.
- Parameters:
A – Pointer to user’s matrix struct
rows – [in] number of rows
cols – [in] number of columns
- Returns:
0 on success, -1 on failure.