1*c311ab13SSascha Wildner#!/usr/bin/env perl
2984263bcSMatthew Dillon
3984263bcSMatthew Dillon#
4984263bcSMatthew Dillon# Test program for /dev/urandom
5984263bcSMatthew Dillon# Read and display random numbers.
6984263bcSMatthew Dillon# This also reads /dev/zero to make sure there is no brokenness there.
7984263bcSMatthew Dillon#
8984263bcSMatthew Dillon# $FreeBSD: src/tools/test/devrandom/hammer.urandom,v 1.4 1999/08/28 00:54:24 peter Exp $
9984263bcSMatthew Dillon#
10984263bcSMatthew Dillon
11984263bcSMatthew Dillonopen(ZERO, "/dev/zero") || die "Cannot open /dev/zero - $!\n";
12984263bcSMatthew Dillon
13984263bcSMatthew Dillonfor (;;) {
14984263bcSMatthew Dillon open(BIN, "/dev/urandom");
15984263bcSMatthew Dillon $len = sysread(BIN, $a, 20);
16984263bcSMatthew Dillon sysread(ZERO, $b, 20);
17984263bcSMatthew Dillon close(BIN);
18