encryption with python

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Sep 10 19:12:02 EDT 2005


In <pan.2005.09.09.11.36.47.132012 at REMOVETHIScyber.com.au>, Steven
D'Aprano wrote:

> last_number_used = 12345
> usable_IDs = []
> 
> def make_studentID():
>     global last_number_used
>     global usable_IDs
>     if not usable_IDs:
>         # generate another batch of IDs in random order
>         usable_IDs = range(last_number_used, last_number_used + 1000)
-         usable_IDs.sort(random.random())
+         random.shuffle(usable_IDs)
>         last_number_used += 1000
>     return usable_IDs.pop()

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list