python生成不重複隨機數和對list亂序

random.sample(list, n)便是從list中隨機選取n個不一樣的元素 python # -*- coding: utf-8 -*- import random # 從一個list中隨機挑選5個 list = [12, 23, 13, 14, 78, 234, 123, 12345] randomlist = random.sample(list, 5) print randomli
相關文章
相關標籤/搜索