0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

python3自分用メモ2 乱数のリストを作る

Last updated at Posted at 2019-12-26

##乱数のリストを作る

####random.sample(population,k)
population: 範囲の指定 
ex) range(1,100) # 1~100までの整数

k: 乱数の要素の数
ex) k=10
ex) # len(random.sample(range(1,100),k=10) -> 10

import random

random_list = random.sample(range(1,100),k=10)
print(random_list)

# result
# [32,16,58,31,78,68,34,90,14,45]

追記
result の結果例に間違いがあったので修正いたしました。

0
2
0

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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?