blob: e35d3688ccf3d9de43661ddc51f5bd1f125bcdae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
############################################################################
#
# File: noise.icn
#
# Subject: Program to generate random noise
#
# Author: Gregg M. Townsend
#
# Date: November 3, 2003
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program generates random 8-bit bytes until killed.
# While it may not be cryptographically strong, it is
# suitable for overwriting a disk or tape for disposal.
#
############################################################################
#
# Links: random
#
############################################################################
$define BUFSIZE 1000000 # working buffer size
$define BLKSIZE 65536 # output block size
link random
procedure main()
local buf, cs
collect(2, 2 * BUFSIZE) # ensure large memory region
randomize() # different results every time
buf := ""
cs := string(&cset)
every 1 to BUFSIZE do
buf ||:= ?cs # initialize buffer randomly
repeat # write random transliterations of random subsets of buffer
writes(map(buf[?(BUFSIZE - BLKSIZE) +: BLKSIZE], cs, scramble(cs)))
end
|