security/nss/lib/freebl/mpi/utils/bbsrand.c

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:99de6fa2b67a
1 /*
2 * bbsrand.c
3 *
4 * Test driver for routines in bbs_rand.h
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <time.h>
14 #include <limits.h>
15
16 #include "bbs_rand.h"
17
18 #define NUM_TESTS 100
19
20 int main(void)
21 {
22 unsigned int seed, result, ix;
23
24 seed = time(NULL);
25 bbs_srand((unsigned char *)&seed, sizeof(seed));
26
27 for(ix = 0; ix < NUM_TESTS; ix++) {
28 result = bbs_rand();
29
30 printf("Test %3u: %08X\n", ix + 1, result);
31 }
32
33 return 0;
34 }

mercurial