zoukankan      html  css  js  c++  java
  • np.random.rand VS np.random.randn

    • np.random.rand()
      Create an array of the given shape and populate it with random samples from a uniform distribution (均匀分布) over [0, 1).

      Example:
      >>> np.random.rand(3,2)
        array([[ 0.14022471, 0.96360618],  #random
        [ 0.37601032, 0.25528411],      #random
        [ 0.49313049, 0.94909878]])     #random

    • np.random.randn()
      Return a sample (or samples) from the “standard normal” distribution(标准正态分布).

      Notes
      For random samples from N(mu, sigma^2), use:
      >>> sigma * np.random.randn(…) + mu

      Example:
      >>> np.random.randn()
      2.1923875335537315 #random

      Two-by-four array of samples from N(3, 6.25):

      >>> 2.5 * np.random.randn(2, 4) + 3
      array([[-4.49401501, 4.00950034, -1.81814867, 7.29718677], #random
      [ 0.39924804, 4.68456316, 4.99394529, 4.84057254]]) #random
  • 相关阅读:
    JS判断单选框是否选中
    Js判断是否有属性
    判断是否有焦点
    Js 替代
    Js解析json
    回车事件
    js解析XML
    Linux常用基础(三)
    Linux常用基础(二)
    Linux常用基础(一)
  • 原文地址:https://www.cnblogs.com/larkiisready/p/11681623.html
Copyright © 2011-2022 走看看