using THRandom_randomWithState in TensorMath.lua