Description
Describe the issue:
I create a random number generator (rng) with a seed to get a reproducible list of random numbers. The first two numbers in this list are num1 and num2. Before generating these numbers, I use the choice() to pick a value in a list. When I generate two numbers again, I get num3 and num4. I expected num2 and num3 to be the same, since they are generated when rng is called twice. However, I get different numbers.
Reproduce the code example:
import numpy as np
rng = np.random.RandomState(0)
num1 = rng.rand()
num2 = rng.rand()
print(num1, num2)
# 0.5488135039273248 0.7151893663724195
alist = range(1,101)
rng = np.random.RandomState(0)
a = rng.choice(alist)
num3 = rng.rand()
num4 = rng.rand()
print(num3, num4)
# 0.5928446182250183 0.8442657485810173
Error message:
No response
Python and NumPy Versions:
Numpy version: 1.26.2
Python version: 3.9.18 (main, Sep 11 2023, 13:21:18)
[GCC 11.2.0]
Runtime Environment:
[{'numpy_version': '1.26.2',
'python': '3.9.18 (main, Sep 11 2023, 13:21:18) \n[GCC 11.2.0]',
'uname': uname_result(system='Linux', node='atl1-1-02-003-16-1.pace.gatech.edu', release='5.14.0-427.26.1.el9_4.x86_64', version='#1 SMP PREEMPT_DYNAMIC Fri Jul 5 11:34:54 EDT 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX'],
'not_found': ['AVX512_KNL',
'AVX512_KNM',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'SkylakeX',
'filepath': '/storage/home/hcoda1/0/sbayramoglu3/.local/lib/python3.9/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so',
'internal_api': 'openblas',
'num_threads': 4,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.23.dev'}]
Context for the issue:
No response