3 * Generates a pseudorandom stream, using the Knuth lfib
4 * (non-cryptographic) pseudorandom generator.
8 /* nettle, low-level cryptographics library
10 * Copyright (C) 2003 Niels Möller
12 * The nettle library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as published by
14 * the Free Software Foundation; either version 2.1 of the License, or (at your
15 * option) any later version.
17 * The nettle library is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with the nettle library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
32 #include "knuth-lfib.h"
45 fprintf(stderr, "Usage: lfib-stream [SEED]\n");
49 main(int argc, char **argv)
51 struct knuth_lfib_ctx ctx;
72 knuth_lfib_init(&ctx, seed);
77 knuth_lfib_random(&ctx, BUFSIZE, buffer);
79 if (fwrite(buffer, 1, BUFSIZE, stdout) < BUFSIZE
80 || fflush(stdout) < 0)
84 /* Not reached. This program is usually terminated by SIGPIPE */