data.py 227 B

12345678910111213
  1. #!/usr/bin/env python3
  2. import numpy as np
  3. import sys
  4. n = int(sys.argv[1])
  5. f = open('data.txt', 'wt')
  6. f.write('%d\n'%(n))
  7. a = np.random.random(size=(n, n)) * 0.6
  8. a = np.rint(a)
  9. np.savetxt(f, a, fmt='%d')
  10. f.close()