title: How to use numpy.random to generate random numbers from a certain distribution?
body: <p>I am somewhat confused about how to use numpy.random to generate random values from a give distribution, say, binomial. I thought it would be </p>
  
  <pre><code>import numpy as np
  np.random.binomial(10, 0.3, 5)
  </code></pre>
  
  <p>However, <a href="https://numpy.org/doc/1.17/reference/random/index.html" rel="nofollow noreferrer">NumPy reference page</a> shows something like</p>
  
  <pre><code>from numpy.random import default_rng
  rg = default_rng()
  rg.binomial(10, 0.3, 5)
  </code></pre>
  
  <p>Both seem to be working well. Which one is the correct or better way? What is the difference if there is any?</p>