How to view the source code of numpy.random.exponential?
<p>I want to see if <code>numpy.random.exponential</code> was implemented using F^{-1} (U) method, where F is the c.d.f of exponential distribution and U is uniform distribution. </p>

<p>I tried <code>numpy.source(random.exponential)</code>, but returned '<em>Not available for this object'</em>. Does it mean this function is not written in Python?</p>

<p>I also tried <code>inspect.getsource(random.exponential)</code>, but returned an error saying it's not module, function, etc.</p>

<p>A lot of numpy functions are written with C/C++ and Fortran. <code>numpy.source()</code> returns the source code only for objects written in Python. It is written on <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.source.html" rel="nofollow">NumPy website</a>.</p>

<p>You can find all of the NumPy functions on their GitHub page. One that you need is written in C. Here is the link to the <a href="https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/distributions.c" rel="nofollow">file</a>.</p>

python numpy random