Code refactoring for uniform sampling and clustered ellipsoidal sampling