librfn
An ad-hoc utility library
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
tests
randtest.c
Go to the documentation of this file.
1
/*
2
* randtest.c
3
*
4
* Part of librfn (a general utility library from redfelineninja.org.uk)
5
*
6
* Copyright (C) 2012 Daniel Thompson <daniel@redfelineninja.org.uk>
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published
10
* by the Free Software Foundation; either version 3 of the License, or
11
* (at your option) any later version.
12
*/
13
14
#undef NDEBUG
15
16
#include <assert.h>
17
#include <stdio.h>
18
#include <stdlib.h>
19
20
#include <
librfn.h
>
21
22
int
main
()
23
{
24
uint32_t seed = 1;
25
uint32_t r;
26
for
(
int
i=1; i<10000; i++) {
27
r =
rand31_r
(&seed);
28
if
(i<=10) {
29
printf(
"%10d%8d\n"
, r, i);
30
}
31
(void)
rand31_r
(&r);
32
}
33
assert(r == 1043618065);
34
35
return
0;
36
}
librfn.h
rand31_r
uint32_t rand31_r(uint32_t *seedp)
Definition:
rand.c:23
main
int main()
Definition:
randtest.c:22
Generated on Sat Feb 6 2016 21:25:32 for librfn by
1.8.10