LoginSignup
9
3

More than 5 years have passed since last update.

Pythonで0から99までのランダムな整数のリストを標準ライブラリのみを使用して作成する

Posted at

numpyは使わずにランダムな整数のリストを作る

調べてみたらnumpyを使ったサンプルはたくさん出てきたのだけど、意外と標準ライブラリのみを使用したパターンが見当たらなかったので、自分用メモとして残しておきます。

import random
random.sample(list(range(0, 100)), k=100) # ---> [70, 33, 4, 73,...

参照

9.6. random — 擬似乱数を生成する Python - 3.6.3 ドキュメント

9
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
3