2 * $Id: prand_trials.c,v 1.1.1.1 2000/05/25 00:28:49 route Exp $
5 * prand_trials.c - psuedorandom number generation
7 * Copyright (c) 1998, 1999, 2000 Mike D. Schiffman <mike@infonexus.com>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include "../../include/config.h"
36 #include "../libnet_test.h"
39 main(int argc, char **argv)
44 printf("Psuedorandom number generation\n");
45 printf("For each trial, 1000 numbers will be generated\n");
48 printf("\n\nPress return for trial 1 (0 - 1)\n\n");
50 for (i = 1000; i; i--)
52 printf("%ld ", libnet_get_prand(LIBNET_PR2));
55 printf("\n\nPress return for trial 2 (0 - 255)\n\n");
57 for (i = 1000; i; i--)
59 printf("%3ld ", libnet_get_prand(LIBNET_PR8));
62 printf("\n\nPress return for trial 3 (0 - 32767)\n\n");
64 for (j = 13, i = 1000; i; i--, j--)
71 printf("%5ld ", libnet_get_prand(LIBNET_PR16));
74 printf("\n\nPress return for trial 4 (0 - 65535)\n\n");
76 for (j = 13, i = 1000; i; i--, j--)
83 printf("%5ld ", libnet_get_prand(LIBNET_PRu16));
86 printf("\n\nPress return for trial 5 (0 - 2147483647)\n\n");
88 for (j = 7, i = 1000; i; i--, j--)
95 printf("%10ld ", libnet_get_prand(LIBNET_PR32));
98 printf("\n\nPress return for trial 6 (0 - 4294967295)\n\n");
100 for (j = 7, i = 1000; i; i--, j--)
107 printf("%10ld ", libnet_get_prand(LIBNET_PRu32));
110 printf("\nCompleted\n");
111 return (EXIT_SUCCESS);