1. Numpy 이용

 
>>> import numpy as np
>>> list(np.random.choice(np.arange(0,10), 5, replace=False))
[1, 7, 4, 8, 5]


2. Random 함수이용

 
>>> import random
>>> random.sample(list(range(0,5)), 4)
[3, 1, 2, 0]