All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tesseract::TRand Class Reference

#include <helpers.h>

Public Member Functions

 TRand ()
 
void set_seed (uinT64 seed)
 
inT32 IntRand ()
 
double SignedRand (double range)
 
double UnsignedRand (double range)
 

Detailed Description

Definition at line 39 of file helpers.h.

Constructor & Destructor Documentation

tesseract::TRand::TRand ( )
inline

Definition at line 41 of file helpers.h.

41 : seed_(1) {}

Member Function Documentation

inT32 tesseract::TRand::IntRand ( )
inline

Definition at line 48 of file helpers.h.

48  {
49  Iterate();
50  return seed_ >> 33;
51  }
void tesseract::TRand::set_seed ( uinT64  seed)
inline

Definition at line 43 of file helpers.h.

43  {
44  seed_ = seed;
45  }
double tesseract::TRand::SignedRand ( double  range)
inline

Definition at line 53 of file helpers.h.

53  {
54  return range * 2.0 * IntRand() / MAX_INT32 - range;
55  }
inT32 IntRand()
Definition: helpers.h:48
#define MAX_INT32
Definition: host.h:120
double tesseract::TRand::UnsignedRand ( double  range)
inline

Definition at line 57 of file helpers.h.

57  {
58  return range * IntRand() / MAX_INT32;
59  }
inT32 IntRand()
Definition: helpers.h:48
#define MAX_INT32
Definition: host.h:120

The documentation for this class was generated from the following file: