Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

QTIsaac< ALPHA, T > Class Template Reference

C++ TEMPLATE VERSION OF Robert J Jenkins Jr's ISAAC Random Number Generator. More...

#include <ccisaac.h>

Collaboration diagram for QTIsaac< ALPHA, T >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef unsigned char byte
enum  { N = (1<<ALPHA) }

Public Member Functions

 QTIsaac ()
 QTIsaac (T a, T b=0, T c=0)
virtual ~QTIsaac (void)
rand (void)
nrand (T n)
 Returns a T between 0 and n-1, inclusive.
This function assures that all returns are evenly distributed over the range [0, n-1], regardless of the value of n and the range of T.

double drand (void)
 Returns a double (floating point number) in the range [0.0, 1.0].

virtual void randinit (randctx *ctx, bool bUseSeed)
virtual void srand (T a=0, T b=0, T c=0, T *s=NULL)

Public Attributes

ls_a
ls_b
ls_c
 Last seeds (to query later).


Protected Member Functions

virtual void isaac (randctx *ctx)
ind (T *mm, T x)
void rngstep (T mix, T &a, T &b, T *&mm, T *&m, T *&m2, T *&r, T &x, T &y)
virtual void shuffle (T &a, T &b, T &c, T &d, T &e, T &f, T &g, T &h)

Private Attributes

randctx m_rc

Detailed Description

template<int ALPHA = (8), class T = ISAAC_INT>
class QTIsaac< ALPHA, T >

C++ TEMPLATE VERSION OF Robert J Jenkins Jr's ISAAC Random Number Generator.

Ported from vanilla C to to template C++ class by Quinn Tyler Jackson on 16-23 July 1998. <quinn@qtj.net>

The function for the expected period of this random number generator, according to Jenkins is: f(a,b) = 2**((a+b*(3+2^^a)-1)
$ f(a,b) = 2^{a+b(3+2^a)-1} $
(where a is ALPHA and b is bitwidth)

So, for a bitwidth of 32 and an ALPHA of 8, the expected period of ISAAC is: $ 2^{8295} $

Jackson has been able to run implementations with an ALPHA as high as 16, or $ 2^{2097263} $

Note:
Additions by Trent Apted <tapted@it.usyd.edu.au> where indicated

doxygen comments by Trent Apted

Parameters:
ALPHA the 'randomness' of the generator (see above)
T the type used -- should be an unsigned integral type

Definition at line 44 of file ccisaac.h.


Member Typedef Documentation

template<int ALPHA = (8), class T = ISAAC_INT>
typedef unsigned char QTIsaac< ALPHA, T >::byte
 

Definition at line 46 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::ind().


Member Enumeration Documentation

template<int ALPHA = (8), class T = ISAAC_INT>
anonymous enum
 

Enumeration values:
N 

Definition at line 47 of file ccisaac.h.


Constructor & Destructor Documentation

template<int ALPHA, class T>
QTIsaac< ALPHA, T >::QTIsaac  ) 
 

Definition at line 108 of file ccisaac.h.

References QTIsaac< ALPHA, T >::srand().

Here is the call graph for this function:

template<int ALPHA, class T>
QTIsaac< ALPHA, T >::QTIsaac a,
b = 0,
c = 0
 

Definition at line 115 of file ccisaac.h.

References QTIsaac< ALPHA, T >::srand().

Here is the call graph for this function:

template<int ALPHA, class T>
QTIsaac< ALPHA, T >::~QTIsaac void   )  [virtual]
 

Definition at line 120 of file ccisaac.h.


Member Function Documentation

template<int ALPHA, class T>
double QTIsaac< ALPHA, T >::drand void   )  [inline]
 

Returns a double (floating point number) in the range [0.0, 1.0].

The values will be evenly distributed, but the number of discrete values is limited to sizeof(T).

Author:
Trent Apted
Returns:
A number from the range [0.0, 1.0]

Definition at line 143 of file ccisaac.h.

References QTIsaac< ALPHA, T >::rand().

Here is the call graph for this function:

template<int ALPHA, class T>
T QTIsaac< ALPHA, T >::ind T *  mm,
x
[inline, protected]
 

Definition at line 217 of file ccisaac.h.

References QTIsaac< ALPHA, T >::byte, and QTIsaac< ALPHA, T >::N.

Referenced by QTIsaac< ALPHA, T >::rngstep().

template<int ALPHA, class T>
void QTIsaac< ALPHA, T >::isaac randctx ctx  )  [protected, virtual]
 

Definition at line 257 of file ccisaac.h.

References QTIsaac< ALPHA, T >::N, QTIsaac< ALPHA, T >::randctx::randa, QTIsaac< ALPHA, T >::randctx::randb, QTIsaac< ALPHA, T >::randctx::randc, QTIsaac< ALPHA, T >::randctx::randmem, QTIsaac< ALPHA, T >::randctx::randrsl, and QTIsaac< ALPHA, T >::rngstep().

Referenced by QTIsaac< ALPHA, T >::rand(), and QTIsaac< ALPHA, T >::randinit().

Here is the call graph for this function:

template<int ALPHA, class T>
T QTIsaac< ALPHA, T >::nrand n  )  [inline]
 

Returns a T between 0 and n-1, inclusive.
This function assures that all returns are evenly distributed over the range [0, n-1], regardless of the value of n and the range of T.

Author:
Trent Apted
Parameters:
n The maximum value + 1 to return
Returns:
A number from the range [0, n-1] (all evenly distributed)

Definition at line 148 of file ccisaac.h.

References QTIsaac< ALPHA, T >::rand().

Here is the call graph for this function:

template<int ALPHA, class T>
T QTIsaac< ALPHA, T >::rand void   )  [inline]
 

Definition at line 138 of file ccisaac.h.

References QTIsaac< ALPHA, T >::isaac(), QTIsaac< ALPHA, T >::m_rc, QTIsaac< ALPHA, T >::N, QTIsaac< ALPHA, T >::randctx::randcnt, and QTIsaac< ALPHA, T >::randctx::randrsl.

Referenced by QTIsaac< ALPHA, T >::drand(), and QTIsaac< ALPHA, T >::nrand().

Here is the call graph for this function:

template<int ALPHA, class T>
void QTIsaac< ALPHA, T >::randinit randctx ctx,
bool  bUseSeed
[virtual]
 

Definition at line 159 of file ccisaac.h.

References GOLDEN_RATIO, QTIsaac< ALPHA, T >::isaac(), QTIsaac< ALPHA, T >::N, QTIsaac< ALPHA, T >::randctx::randa, QTIsaac< ALPHA, T >::randctx::randb, QTIsaac< ALPHA, T >::randctx::randc, QTIsaac< ALPHA, T >::randctx::randcnt, QTIsaac< ALPHA, T >::randctx::randmem, QTIsaac< ALPHA, T >::randctx::randrsl, and QTIsaac< ALPHA, T >::shuffle().

Referenced by QTIsaac< ALPHA, T >::srand().

Here is the call graph for this function:

template<int ALPHA, class T>
void QTIsaac< ALPHA, T >::rngstep mix,
T &  a,
T &  b,
T *&  mm,
T *&  m,
T *&  m2,
T *&  r,
T &  x,
T &  y
[inline, protected]
 

Definition at line 226 of file ccisaac.h.

References QTIsaac< ALPHA, T >::ind().

Referenced by QTIsaac< ALPHA, T >::isaac().

Here is the call graph for this function:

template<int ALPHA, class T>
void QTIsaac< ALPHA, T >::shuffle T &  a,
T &  b,
T &  c,
T &  d,
T &  e,
T &  f,
T &  g,
T &  h
[protected, virtual]
 

Definition at line 234 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::randinit().

template<int ALPHA, class T>
void QTIsaac< ALPHA, T >::srand a = 0,
b = 0,
c = 0,
T *  s = NULL
[virtual]
 

Definition at line 125 of file ccisaac.h.

References QTIsaac< ALPHA, T >::ls_a, QTIsaac< ALPHA, T >::ls_b, QTIsaac< ALPHA, T >::ls_c, QTIsaac< ALPHA, T >::m_rc, QTIsaac< ALPHA, T >::N, QTIsaac< ALPHA, T >::randctx::randa, QTIsaac< ALPHA, T >::randctx::randb, QTIsaac< ALPHA, T >::randctx::randc, QTIsaac< ALPHA, T >::randinit(), and QTIsaac< ALPHA, T >::randctx::randrsl.

Referenced by QTIsaac< ALPHA, T >::QTIsaac().

Here is the call graph for this function:


Member Data Documentation

template<int ALPHA = (8), class T = ISAAC_INT>
T QTIsaac< ALPHA, T >::ls_a
 

Definition at line 92 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::srand().

template<int ALPHA = (8), class T = ISAAC_INT>
T QTIsaac< ALPHA, T >::ls_b
 

Definition at line 92 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::srand().

template<int ALPHA = (8), class T = ISAAC_INT>
T QTIsaac< ALPHA, T >::ls_c
 

Last seeds (to query later).

Definition at line 92 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::srand().

template<int ALPHA = (8), class T = ISAAC_INT>
randctx QTIsaac< ALPHA, T >::m_rc [private]
 

Definition at line 104 of file ccisaac.h.

Referenced by QTIsaac< ALPHA, T >::rand(), and QTIsaac< ALPHA, T >::srand().


The documentation for this class was generated from the following file:
Generated on Fri Oct 3 18:41:21 2003 for taptedDevTools by doxygen 1.3.4