Good morning!
I am looking to create an analog of some code in R
Basically, I have a function that, among other things, takes a seed provided by the user (default is NULL), along with a specific distribution (default is rnorm), and outputs 9 random numbers, saved as a vector "e". This is what it looked like in R...
function (...other variables..., seed=NULL, dist=rnorm)
...other code...
e <- dist(9,...)
Now I'm converting the function to Python, but I can't quite seem to find an analog that would work, where a user can replace the base seed and distribution.
Here's what i have so far...
def (...other variables..., seed=None, dist=?):
...other code...
e = dist(9)
See numpy.random.normal
function (doc here)
For instance:
import numpy as np
np.random.normal(0,1,9)
array([ 0.33593283, -0.18149502, 0.43148566, 1.46831794, -0.72244867,
-1.40048855, 0.52366471, 0.34099135, 0.71654992])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With