Skip to content
Advertisement

Create a matrix with np.random.normal

I need to create an nxn matrix in which the numbers in the cells are distributed following a Gaussian distribution. This code may not go well because it fills a cell with a sequence. how can I do?

JavaScript

Advertisement

Answer

Edited for border of zeros

np.random.normal takes a size keyword argument. You can use it like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement