| 1 |
/* |
| 2 |
* libmowgli: A collection of useful routines for programming. |
| 3 |
* randomtest.c: Testsuite for the random number generator. |
| 4 |
* |
| 5 |
* Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk> |
| 6 |
* Algorithm copyright (c) 1999-2007 Takuji Nishimura and Makoto Matsumoto |
| 7 |
* |
| 8 |
* Redistribution and use in source and binary forms, with or without |
| 9 |
* modification, are permitted provided that the following conditions are |
| 10 |
* met: |
| 11 |
* |
| 12 |
* 1. Redistributions of source code must retain the above copyright notice, |
| 13 |
* this list of conditions and the following disclaimer. |
| 14 |
* |
| 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. |
| 18 |
* |
| 19 |
* 3. The name of the author may not be used to endorse or promote products |
| 20 |
* derived from this software without specific prior written permission. |
| 21 |
* |
| 22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 23 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 24 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 25 |
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 26 |
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 27 |
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 28 |
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 29 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 30 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 31 |
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 32 |
* POSSIBILITY OF SUCH DAMAGE. |
| 33 |
*/ |
| 34 |
#include <mowgli.h> |
| 35 |
|
| 36 |
int |
| 37 |
main(int argc, char *argv[]) |
| 38 |
{ |
| 39 |
mowgli_random_t *r = mowgli_random_create(); |
| 40 |
int i; |
| 41 |
|
| 42 |
printf("1000 iterations:\n"); |
| 43 |
|
| 44 |
for (i = 0; i < 1000; i++) |
| 45 |
{ |
| 46 |
printf("%10u ", mowgli_random_int(r)); |
| 47 |
|
| 48 |
if (i % 5 == 4) |
| 49 |
printf("\n"); |
| 50 |
} |
| 51 |
|
| 52 |
mowgli_object_unref(r); |
| 53 |
|
| 54 |
return 0; |
| 55 |
} |