blob: 9de8b7cb4e6df6b5929c915566dff74163efbcf2 [file] [log] [blame]
Song Liu81f77fd2018-03-14 10:23:22 -07001#include <stdio.h>
2#include <unistd.h>
3#include <sys/types.h>
4#include <sys/stat.h>
5#include <fcntl.h>
6#include <stdlib.h>
7
8#define BUF_SIZE 256
Song Liu13790d12018-05-07 10:50:49 -07009
10int main(int argc, char *argv[])
Song Liu81f77fd2018-03-14 10:23:22 -070011{
12 int fd = open("/dev/urandom", O_RDONLY);
13 int i;
14 char buf[BUF_SIZE];
Song Liu13790d12018-05-07 10:50:49 -070015 int count = 4;
Song Liu81f77fd2018-03-14 10:23:22 -070016
17 if (fd < 0)
18 return 1;
Song Liu13790d12018-05-07 10:50:49 -070019
20 if (argc == 2)
21 count = atoi(argv[1]);
22
23 for (i = 0; i < count; ++i)
Song Liu81f77fd2018-03-14 10:23:22 -070024 read(fd, buf, BUF_SIZE);
25
26 close(fd);
27 return 0;
28}