Fix random multivariate normal

Check that covariance matrix passed to random.multivariate_normal is positive-semidefinite. Also refactor that function a bit to avoid a DeprecationWarning and potential integer overflow.