fork(1) download
  1. import random
  2. import platform
  3.  
  4. assert platform.python_version()[0:3] == "3.7", "Python version 3.7 must be used."
  5.  
  6. # The number of selections
  7. NUM_SELECTED = 15
  8. # Entry numbers that passed the screening process (example is shown)
  9. ENTRIES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 28, 29, 31, 33]
  10. assert NUM_SELECTED < len(ENTRIES), "Selection must happen"
  11.  
  12. # Block hashes from certain block heights that were previously announced:
  13. # Below is the example by block heights 629530-629534.
  14. hashes = [
  15. 0x00000000000000000006F349AA480F67A2B603496DA07FD0F566680293B2D3E4,
  16. 0x0000000000000000000E4BF1CA971D88B29D31B84751AE6BDF8F2F5F25E5D99E,
  17. 0x00000000000000000003A91B8D6D37940269AE8DE9219176DCD6BA448CE0AC75,
  18. 0x0000000000000000000137A2AC232E19D2163A4A28B2F1F49CCD35052579451E,
  19. 0x00000000000000000008A17371C0F62112227C28B83DD88C5218CAD648484E7F,
  20. ]
  21.  
  22. seed = sum(hashes)
  23. random.seed(seed)
  24. print("Entries:", ENTRIES, "(%d in total)" % len(ENTRIES))
  25. print("Random seed: %d" % seed)
  26. print()
  27.  
  28. number_order = sorted(random.sample(ENTRIES, len(ENTRIES))[0:NUM_SELECTED])
  29.  
  30. print("Result")
  31. print("Selected entries:", number_order)
  32.  
Success #stdin #stdout 0.04s 12704KB
stdin
Standard input is empty
stdout
Entries: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 28, 29, 31, 33] (26 in total)
Random seed: 3328922384685780924223003444097241387041554684534517140

Result
Selected entries: [1, 2, 3, 5, 7, 8, 9, 10, 11, 16, 17, 18, 21, 23, 25]