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

Random.h

Go to the documentation of this file.
00001 #ifndef RANDOM_H__3E00EE5B_33A2_4F41_BEA5_4AAD68D5C1EE__INCLUDED_
00002 #define RANDOM_H__3E00EE5B_33A2_4F41_BEA5_4AAD68D5C1EE__INCLUDED_
00003 #include <stdlib.h>
00004 
00005 class Random  {
00006 public:
00007    Random();
00008    virtual ~Random();
00009 
00011    static void setSeed(unsigned int seed=0);
00012 
00014    static float getFloat(){
00015       return rand() / (float) RAND_MAX;
00016    }
00017 
00018 
00020    static double getDouble(){
00021       return rand() / (double) RAND_MAX;
00022    }
00023 
00025    static unsigned int getInt(unsigned int n){
00026       return rand() % (n+1);
00027    }
00028 
00029 };
00030 
00031 #endif // RANDOM_H__3E00EE5B_33A2_4F41_BEA5_4AAD68D5C1EE__INCLUDED_

Thyrix homepageUsers' guide

(C) Arxia 2004-2005