Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

randomly pick a value in the list

import random

l = [0, 1, 2, 3, 4]

print(random.sample(l, 3))
# [1, 3, 2]

print(type(random.sample(l, 3)))
# <class 'list'>
Source by note.nkmk.me #
 
PREVIOUS NEXT
Tagged: #randomly #pick #list
ADD COMMENT
Topic
Name
3+8 =