• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #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
9 
main(int argc,char * argv[])10 int main(int argc, char *argv[])
11 {
12 	int fd = open("/dev/urandom", O_RDONLY);
13 	int i;
14 	char buf[BUF_SIZE];
15 	int count = 4;
16 
17 	if (fd < 0)
18 		return 1;
19 
20 	if (argc == 2)
21 		count = atoi(argv[1]);
22 
23 	for (i = 0; i < count; ++i)
24 		read(fd, buf, BUF_SIZE);
25 
26 	close(fd);
27 	return 0;
28 }
29