Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. import time
  2. import numpy as np
  3. size = 5000
  4. upperBound = 20
  5. dataSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  6. dataLength = np.random.randint(0, high=upperBound, size=size, dtype='l')
  7. randomNumber = np.random.randint(0, high=62, size=size * upperBound, dtype='l')
  8. count = 0
  9. dataCount = 0
  10. start_time = time.time()
  11. for i in range(size):
  12. lineData = ""
  13. for j in range(dataLength[i]):
  14. lineData = lineData + dataSet[randomNumber[count]]
  15. count = count + 1
  16. print(lineData)
  17. dataCount = dataCount + 1
  18. time = str(time.time() - start_time)
  19. print("------------------------n" + "It took this many sedonds: " + time)
  20. print("There were " + str(dataCount) + " many data generations.")
  21.  
  22. import time
  23. import cupy as cp
  24. size = 5000
  25. upperBound = 20
  26. dataSet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  27. dataLength = cp.random.randint(0, high=upperBound, size= size,dtype='l')
  28. randomNumber = cp.random.randint(0, high=62, size= upperBound * size,dtype='l')
  29. count = 0
  30. dataCount = 0
  31. start_time = time.time()
  32. for i in range(size):
  33. lineData = ""
  34. for j in range(int(dataLength[i])):
  35. lineData = lineData + str(dataSet[int(randomNumber[count])])
  36. count = count + 1
  37. print(lineData)
  38. dataCount = dataCount + 1
  39. time = str(time.time() - start_time)
  40. print("-------------------n" +"It took this many seconds: " + time)
  41. print("There were " + str(dataCount) + " many data generations.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement