random.c File Reference

#include "nsd.h"

Defines

#define MSEC_TO_COUNT   31
#define ROULETTE_PRE_ITERS   10

Functions

int NsTclRandObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
double Ns_DRand (void)
void Ns_GenSeeds (unsigned long *seedsPtr, int nseeds)

Define Documentation

#define MSEC_TO_COUNT   31

========================================================================== AT&T Seed Generation Code ==========================================================================

The authors of this software are Don Mitchell and Matt Blaze. Copyright (c) 1995 by AT&T. Permission to use, copy, and modify this software without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software.

This software may be subject to United States export controls.

THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.

#define ROULETTE_PRE_ITERS   10


Function Documentation

double Ns_DRand ( void   ) 

----------------------------------------------------------------------

Ns_DRand --

Return a random double value between 0 and 1.0.

Results: Random double.

Side effects: Will generate random seed on first call.

----------------------------------------------------------------------

void Ns_GenSeeds ( unsigned long *  seedsPtr,
int  nseeds 
)

----------------------------------------------------------------------

Ns_GenSeeds --

Calculate an array of random seeds used by both Ns_DRand() and the old SSL module.

Results: None.

Side effects: None.

----------------------------------------------------------------------

int NsTclRandObjCmd ( ClientData  arg,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *CONST  objv[] 
)

----------------------------------------------------------------------

NsTclRandObjCmd --

This procedure implements the AOLserver Tcl

ns_rand ?maximum?

command.

Results: The Tcl result string contains a random number, either a double >= 0.0 and < 1.0 or a integer >= 0 and < max.

Side effects: None external.

Note: Interpreters share the static variables which randomizes the the random numbers even more.

----------------------------------------------------------------------


Generated on Tue Sep 4 19:58:56 2007 by  doxygen 1.5.1