小编Jen*_*eto的帖子

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]])
Run Code Online (Sandbox Code Playgroud)

My matlab code is:

rng(1337, 'twister');
A = randn(1,3)
A = -0.7832   -0.7012   -0.7178
Run Code Online (Sandbox Code Playgroud)

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

python random matlab random-seed

1
推荐指数
1
解决办法
380
查看次数

标签 统计

matlab ×1

python ×1

random ×1

random-seed ×1