blob: f431cd8c53222124361d1e04b27153187f34d1fb [file] [log] [blame]
Benny Prijonoe7224612005-11-13 19:40:44 +00001/* $Id$
2 *
3 */
4/*
5 * PJLIB - PJ Foundation Library
6 * (C)2003-2005 Benny Prijono <bennylp@bulukucing.org>
7 *
8 * Author:
9 * Benny Prijono <bennylp@bulukucing.org>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25/* $Log: /pjproject-0.3/pjlib/include/pj/rand.h $
26 *
27 * 3 10/14/05 12:26a Bennylp
28 * Finished error code framework, some fixes in ioqueue, etc. Pretty
29 * major.
30 *
31 * 2 9/17/05 10:37a Bennylp
32 * Major reorganization towards version 0.3.
33 *
34 * 1 9/15/05 8:40p Bennylp
35 * Created.
36 */
37#ifndef __PJ_RAND_H__
38#define __PJ_RAND_H__
39
40/**
41 * @file rand.h
42 * @brief Random Number Generator.
43 */
44
45#include <pj/config.h>
46
47PJ_BEGIN_DECL
48
49
50/**
51 * @defgroup PJ_RAND Random Number Generator
52 * @ingroup PJ_MISC
53 * @{
54 * This module contains functions for generating random numbers.
55 * This abstraction is needed not only because not all platforms have
56 * \a rand() and \a srand(), but also on some platforms \a rand()
57 * only has 16-bit randomness, which is not good enough.
58 */
59
60/**
61 * Put in seed to random number generator.
62 *
63 * @param seed Seed value.
64 */
65PJ_DECL(void) pj_srand(unsigned int seed);
66
67
68/**
69 * Generate random integer with 32bit randomness.
70 *
71 * @return a random integer.
72 */
73PJ_DECL(int) pj_rand(void);
74
75
76/** @} */
77
78
79PJ_END_DECL
80
81
82#endif /* __PJ_RAND_H__ */
83