Update files for libpcap-1.8.1 import
[dragonfly.git] / tools / test / devrandom / hammer.random
blob4e1db724c42ad28d048841cbb6add20298889876
1 #!/usr/bin/env perl
4 # Test program for /dev/random
5 # Read and display random numbers.
6 # Try tapping shift/alt/ctrl to get more randomness.
8 # $FreeBSD: src/tools/test/devrandom/hammer.random,v 1.4 1999/08/28 00:54:24 peter Exp $
11 for (;;) {
12 open(BIN, "/dev/random") || die "Cannot open /dev/random - $!\n";
13 $len = sysread(BIN, $a, 128);
14 close(BIN);
15 if ($len > 0) {
16 print "$len bytes read: ";
17 for ($j = 0; $j < $len; $j++) {
18 $k = unpack("C", substr($a, $j, 1));
19 printf("%.2X ", $k);
21 printf "\n";