round decimal values

jo jo at email.com
Thu Jun 24 10:23:03 EDT 2021


Hi,

this code generate 4 values with gaussian distribution (mu=5, sigma=1):

import numpy as np   
x = np.random.normal(5, 1, 4)
print(x)

Output:
[5.87879753 3.29162433 3.83024698 4.92997148]

I would like to round the output like this:

[6, 3, 4, 5]

What should I add to the code?

Thank you

j.


More information about the Python-list mailing list