dimanche 23 septembre 2018

How to generate random numbers of unique modulus values in python

import random
value = 1000
a = []
i = 0
b = [None] * 16
print('value = ',1000)
for x in range(value):
    a.append(x)
    random.Random(4).shuffle(a)
print(a)
for x in range(16):
    b[x] = a[x]
print(b)

This code generate 16 random numbers selected up to the range 1000.But how to generate numbers that has unique modulus values like this in python ?




Aucun commentaire:

Enregistrer un commentaire