logo
  • 教程列表
  • SO官方文檔
  • 生成隨機資料
    • 生成從特定分佈中提取的隨機數
    • 建立隨機整數
    • 從陣列中選擇隨機樣本
    • 設定種子
    • 建立一個簡單的隨機陣列
  1. StackOverflow 文件
  2. numpy 教程
  3. 生成隨機資料
  4. 建立隨機整數

建立隨機整數

Created: November-22, 2018

 placeholderCopy# Creates a 5x5 random integer array ranging from 10 (inclusive) to 20 (inclusive)
np.random.randint(10, 20, (5, 5))

''' 
Out: array([[12, 14, 17, 16, 18],
            [18, 11, 16, 17, 17],
            [18, 11, 15, 19, 18],
            [19, 14, 13, 10, 13],
            [15, 10, 12, 13, 18]])
'''
  • 從陣列中選擇隨機樣本
  • 生成從特定分佈中提取的隨機數

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明