xorp

random.h

00001 /* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */
00002 /* vim:set sts=4 ts=8: */
00003 
00004 /*
00005  * Copyright (c) 2001-2009 XORP, Inc.
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License, Version
00009  * 2.1, June 1999 as published by the Free Software Foundation.
00010  * Redistribution and/or modification of this program under the terms of
00011  * any other version of the GNU Lesser General Public License is not
00012  * permitted.
00013  * 
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00017  * see the GNU Lesser General Public License, Version 2.1, a copy of
00018  * which can be found in the XORP LICENSE.lgpl file.
00019  * 
00020  * XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00021  * http://xorp.net
00022  */
00023 
00024 /*
00025  * $XORP: xorp/libxorp/random.h,v 1.10 2008/10/02 21:57:32 bms Exp $
00026  */
00027 
00028 #ifndef __LIBXORP_RANDOM_H__
00029 #define __LIBXORP_RANDOM_H__
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 /*
00036  * Define the maximum bound of the random() function
00037  * as per 4.2BSD / SUSV2:
00038  * http://www.opengroup.org/onlinepubs/007908799/xsh/initstate.html
00039  */
00040 #define XORP_RANDOM_MAX     0x7FFFFFFF  /* 2^31 - 1 in 2's complement */
00041 
00042 long    xorp_random(void);
00043 void    xorp_srandom(unsigned long);
00044 char*   xorp_initstate(unsigned long, char *, long);
00045 char*   xorp_setstate(char *);
00046 void    xorp_srandomdev(void);
00047 
00048 #ifdef __cplusplus
00049 }
00050 #endif
00051 
00052 #endif /* __LIBXORP_RANDOM_H__ */
 All Classes Namespaces Functions Variables Typedefs Enumerations