fork download
  1. uint32_t myrand(void)
  2. {
  3. static uint32_t vec[] = {1, 1812433254, 3713160357, 3109174145};
  4. static int i = 4;
  5. __m128i x, y, z;
  6. if (i == 4) {
  7. x = _mm_load_si128((__m128i *)vec);
  8. y = _mm_xor_si128(x, _mm_slli_si128(x, 1));
  9. z = _mm_xor_si128(y, _mm_srli_si128(_mm_srli_epi64(y, 5), 8));
  10. _mm_store_si128((__m128i *)vec, _mm_xor_si128(z, _mm_slli_si128(_mm_slli_epi64(z, 11), 8)));
  11. i = 0;
  12. }
  13. return vec[i++];
  14. }
  15.  
  16. void set_random_key(MULTI2 *m2)
  17. {
  18. uint8_t key[8];
  19. uint32_t n;
  20. n = myrand();
  21. key[0] = (n >> 24) & 0xFF;
  22. key[1] = (n >> 16) & 0xFF;
  23. key[2] = (n >> 8) & 0xFF;
  24. key[3] = (n >> 0) & 0xFF;
  25. n = myrand();
  26. key[4] = (n >> 24) & 0xFF;
  27. key[5] = (n >> 16) & 0xFF;
  28. key[6] = (n >> 8) & 0xFF;
  29. key[7] = (n >> 0) & 0xFF;
  30. m2->set_scramble_key(m2, key);
  31. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty