Closed hardy-hq closed 1 year ago
As the numpy library is used for random generation, you can simply use seed function from numpy. https://numpy.org/doc/stable/reference/random/generated/numpy.random.seed.html
But I use random.seed for crv.py::init, and the _simpleConstraints doesn't seem to take effect ` def init(self): random.seed(151515)
# all random variables, map NAME -> DOMAIN
self._randVariables = {}
# all simple constraints: functions of single random variable and
# optional non-random variables
# map VARIABLE NAME -> FUNCTION
self._simpleConstraints = {}
# all implicit constraints: functions that requires to be resolved by a
# Solver
# map TUPLE OF VARIABLE NAMES -> FUNCTION
self._implConstraints = {}
# all implicit distributions: functions that involve implicit random
# variables and single unconstrained variable
# map TUPLE OF VARIABLE NAMES -> FUNCTION
self._implDistributions = {}
# all simple distributions: functions of unconstrained random variables
# and non-random variables
# map VARIABLE NAME -> FUNCTION
self._simpleDistributions = {}
# list of lists containing random variables solving order
self._solve_order = []`
for example ,'delay1' and 'delay2' change randomly every time crv_test.py Running test_simple_1 {'delay1': 2, 'delay2': 3} delay1 = 2, delay2 = 3, delay3 = 4, data = 8835 {'delay1': 2, 'delay2': 3} delay1 = 2, delay2 = 3, delay3 = 4, data = 4417 {'delay1': 3, 'delay2': 3} delay1 = 3, delay2 = 3, delay3 = 4, data = 4417 {'delay1': 2, 'delay2': 2} delay1 = 2, delay2 = 2, delay3 = 4, data = 4417 {'delay1': 1, 'delay2': 3} delay1 = 1, delay2 = 3, delay3 = 4, data = 4417 {'delay1': 3, 'delay2': 4} delay1 = 3, delay2 = 4, delay3 = 4, data = 4417 {'delay1': 1, 'delay2': 2} delay1 = 1, delay2 = 2, delay3 = 4, data = 4417 {'delay1': 0, 'delay2': 3} delay1 = 0, delay2 = 3, delay3 = 4, data = 4417 {'delay1': 4, 'delay2': 4} delay1 = 4, delay2 = 4, delay3 = 4, data = 4417 {'delay1': 0, 'delay2': 1} delay1 = 0, delay2 = 1, delay3 = 4, data = 4417
random.seed is not a numpy function. Please use numpy.random.seed instead. You probably use this one: https://docs.python.org/3/library/random.html
thanks
Can cocotb_coverage cocotb_crv realize random seed? How to use random seed?