functional for doRand and doMatrix, but no catches for Matrix errors