diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index b4d3871c229..064a4100fdc 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -324,8 +324,8 @@ def create_test_data( obj["var4"] = ( "dim1", pd.Categorical( - np.random.choice( - list(string.ascii_lowercase[: np.random.randint(5)]), + rs.choice( + list(string.ascii_lowercase[: rs.randint(1, 5)]), size=dim_sizes[0], ) ), @@ -333,7 +333,7 @@ def create_test_data( if dim_sizes == _DEFAULT_TEST_DIM_SIZES: numbers_values = np.array([0, 1, 2, 0, 0, 1, 1, 2, 2, 3], dtype="int64") else: - numbers_values = np.random.randint(0, 3, _dims["dim3"], dtype="int64") + numbers_values = rs.randint(0, 3, _dims["dim3"], dtype="int64") obj.coords["numbers"] = ("dim3", numbers_values) obj.encoding = {"foo": "bar"} assert_writeable(obj)