Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to multi random pick from list python

import random

# Randomly select same sample list every time
alist = [20.5, 40.5, 30.5, 50.5, 70.5]
sample_list = random.sample(alist, 3)
print(sample_list)

# output:
#[40.5, 30.5, 20.5]
 
PREVIOUS NEXT
Tagged: #multi #random #pick #list #python
ADD COMMENT
Topic
Name
7+6 =