Random number generation
In order to make your simulations reproducible, it is important to configure arandom seed which makes your code deterministic. When Sionna is loaded, itinstantiates random number generators (RNGs) forPython,NumPy, andTensorFlow. Youcan then set a single seed which will make all of yourresults deterministic, as long as only these RNGs are used. In the cell below,you can see how this seed is set and how the different RNGs can be used in yourcode. All of Sionna PHY’s built-in functions realy on these RNGs.
fromsionna.phyimportconfigconfig.seed=40# Python RNG - use instead of# import random# random.randint(0, 10)print(config.py_rng.randint(0,10))# NumPy RNG - use instead of# import numpy as np# np.random.randint(0, 10)print(config.np_rng.integers(0,10))# TensorFlow RNG - use instead of# import tensorflow as tf# tf.random.uniform(shape=[1], minval=0, maxval=10, dtype=tf.int32)print(config.tf_rng.uniform(shape=[1],minval=0,maxval=10,dtype=tf.int32))
75tf.Tensor([2], shape=(1,), dtype=int32)