mardi 23 juin 2020

produce same array in matlab and python with randn

Hello I'm trying to produce the same vector in python and matlab but I'm not able to get it. Someone knows how to do that?

My python code is:

np.random.seed(1337)
A = np.random.randn(1,3)
A = array([[-0.70318731, -0.49028236, -0.32181433]])

My matlab code is:

rng(1337, 'twister');
A = randn(1,3)
A = -0.7832   -0.7012   -0.7178

I would like to both give the same vector...




Aucun commentaire:

Enregistrer un commentaire