Is there anyway that I can generate random numbers with its own seed for each class instance. To make this point clear, the following is a minimal codes. Successful results will make the first 10 digits equal to the last 10 digits.
import sys
import numpy as np
class DataGen:
def __init__(self, seed):
np.random.seed(seed)
def generate(self):
return np.random.uniform(0, 1, size=10)
a=DataGen(1)
print(a.generate())
print("another 10")
print(a.generate())
b=DataGen(1)
print("another 10")
print(a.generate()) #generate random numbers use a.
print("another 10")
print(b.generate()) #first time to use b.