summaryrefslogtreecommitdiff
path: root/pypers/marelli/materiale/proc2a.py
blob: 565b1b1dc0ea4ccf6c9ae0abb2773e78e51801f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# proc2a.py
"Un processo che genera numeri casuali e li salva nel file data.txt"

import random

def main():
    ro = random.Random()
    out = file("data.txt", "w")
    for number in ro.sample(range(1000), 100):
        print >> out, number
    out.close()
    print "Dati salvati sul file 'data.txt'"
    
if __name__ == "__main__":
    main()