Advertisement
Kyrexar

Rand test

May 1st, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: latin-1 -*-
  3. import os, sys, random, time
  4. N = 10**6
  5.  
  6. ti = time.time()
  7. dado = [0]*7
  8. for i in range(N) :
  9.     dado[random.randrange(1,7)]+=1
  10. tf = time.time()
  11. dif = (tf-ti)
  12.  
  13. for i in range(1,7) :
  14.     print(i, "está repetido", dado[i], "veces")
  15.    
  16. print(N, "numeros pseudoaleatorios en",dif,"segundos")
  17.  
  18. time.sleep(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement