]> arthur.barton.de Git - bup.git/blob - Documentation/bup-random.md
get: adjust for python 3 and test there
[bup.git] / Documentation / bup-random.md
1 % bup-random(1) Bup %BUP_VERSION%
2 % Avery Pennarun <apenwarr@gmail.com>
3 % %BUP_DATE%
4
5 # NAME
6
7 bup-random - generate a stream of random output
8
9 # SYNOPSIS
10
11 bup random [-S seed] [-fv] \<numbytes\>
12
13 # DESCRIPTION
14
15 `bup random` produces a stream of pseudorandom output bytes to
16 stdout.  Note: the bytes are *not* generated using a
17 cryptographic algorithm and should never be used for
18 security.
19
20 Note that the stream of random bytes will be identical
21 every time `bup random` is run, unless you provide a
22 different `seed` value.  This is intentional: the purpose
23 of this program is to be able to run repeatable tests on
24 large amounts of data, so we want identical data every
25 time.
26
27 `bup random` generates about 240 megabytes per second on a
28 modern test system (Intel Core2), which is faster than you
29 could achieve by reading data from most disks.  Thus, it
30 can be helpful when running microbenchmarks.
31
32 # OPTIONS
33
34 \<numbytes\>
35 :   the number of bytes of data to generate.  Can be used
36     with the suffices `k`, `M`, or `G` to indicate
37     kilobytes, megabytes, or gigabytes, respectively.
38     
39 -S, \--seed=*seed*
40 :   use the given value to seed the pseudorandom number
41     generator.  The generated output stream will be
42     identical for every stream seeded with the same value. 
43     The default seed is 1.  A seed value of 0 is equivalent
44     to 1.
45
46 -f, \--force
47 :   generate output even if stdout is a tty.  (Generating
48     random data to a tty is generally considered
49     ill-advised, but you can do if you really want.)
50     
51 -v, \--verbose
52 :   print a progress message showing the number of bytes that
53     has been output so far.
54
55 # EXAMPLES
56     
57     $ bup random 1k | sha1sum
58     2108c55d0a2687c8dacf9192677c58437a55db71  -
59     
60     $ bup random -S1 1k | sha1sum
61     2108c55d0a2687c8dacf9192677c58437a55db71  -
62     
63     $ bup random -S2 1k | sha1sum
64     f71acb90e135d98dad7efc136e8d2cc30573e71a  -
65     
66     $ time bup random 1G >/dev/null
67     Random: 1024 Mbytes, done.
68     
69     real   0m4.261s
70     user   0m4.048s
71     sys    0m0.172s
72     
73     $ bup random 1G | bup split -t --bench
74     Random: 1024 Mbytes, done.
75     bup: 1048576.00kbytes in 18.59 secs = 56417.78 kbytes/sec
76     1092599b9c7b2909652ef1e6edac0796bfbfc573
77     
78 # BUP
79
80 Part of the `bup`(1) suite.