fork download
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. void fillrandom(char *dst, size_t len) {
  7. for (int k = 0; k < len; k += 4) {
  8. *(uint32_t*)(dst+k) = rand() & 0x7f7f7f7f; // fill 4 bytes at once
  9. }
  10. }
  11.  
  12. int main(void) {
  13. char x[40];
  14. srand(time(0));
  15. fillrandom(x, 40);
  16. for (int i = 0; i < 40; i++) printf("%02x ", x[i]);
  17. puts("");
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 4124KB
stdin
Standard input is empty
stdout
5b 03 16 03 3c 54 71 09 65 26 2f 26 18 4a 74 53 4e 15 51 0a 45 15 4b 5f 77 7a 5b 7b 05 60 1a 19 04 32 11 75 60 09 1d 62