Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

random.h

Go to the documentation of this file.
00001 #ifndef MSL_RANDOM_H
00002 #define MSL_RANDOM_H
00003 
00004 
00005 class MSLRandomSource {
00006 
00007   long  table[32];
00008   long* ptr0;
00009   long* ptr1;
00010   long* ptr2;
00011   long* ptr_end;
00012   unsigned long pat;
00013   int  prec;
00014   int  low;
00015   int  diff;
00016   bool bit_mode;
00017   unsigned long buffer;
00018   static int count;
00019   void          init_table();
00020 
00021 public:
00022 
00023   unsigned long get_rand31();
00024   unsigned long get_rand32();
00025   MSLRandomSource();
00026   MSLRandomSource(int p);
00027   MSLRandomSource(int low, int high);
00028   unsigned long get() { unsigned long r = get_rand32();
00029 #if defined(WORD_LENGTH_64)
00030  r = (r << 32) | get_rand32();
00031 #endif
00032  return r; }
00033   void set_seed(int s);
00034   void set_range(int low, int high);
00035   int set_precision(int p);
00036   int get_precision() { return prec; }
00037 #if defined(__HAS_BUILTIN_BOOL__)
00038   MSLRandomSource& operator>>(char& x);
00039 #endif
00040   MSLRandomSource& operator>>(unsigned char& x);
00041   MSLRandomSource& operator>>(int& x);
00042   MSLRandomSource& operator>>(long& x);
00043   MSLRandomSource& operator>>(unsigned int& x);
00044   MSLRandomSource& operator>>(unsigned long& x);
00045   MSLRandomSource& operator>>(double& x);
00046   MSLRandomSource& operator>>(float& x);
00047   MSLRandomSource& operator>>(bool& b);
00048   int operator()();    
00049   int operator()(int prec);
00050   int operator()(int low, int high);
00051 };
00052 
00053 
00054 #endif
Motion Strategy Library


Web page maintained by Steve LaValle
Partial support provided by NSF CAREER Award IRI-970228 (LaValle), Honda Research, and Iowa State University.
Contributors: Anna Atramentov, Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.