Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
STYLE: Set a seed for random number generation reproducibility
Browse files Browse the repository at this point in the history
Set a seed for random number generation reproducibility in test. Use
NumPy's `Generator` clas to generate random numbers.

Documentation:
https://numpy.org/doc/stable/reference/random/new-or-different.html
  • Loading branch information
jhlegarreta committed Jun 12, 2024
1 parent c09cac4 commit 1e65e59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/test_data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@


def test_apply_affines():
rng = np.random.default_rng(1234)

# Create synthetic dataset
nii_data = np.random.rand(10, 10, 10, 10)
nii_data = rng.random((10, 10, 10, 10))

# Generate Nifti1Image
nii = nib.Nifti1Image(nii_data, np.eye(4))
Expand Down

0 comments on commit 1e65e59

Please sign in to comment.