Moved more functions to matrix.cpp. No longer pass MIN_RAND and MAX_RAND to functions