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

FCSRandom.cpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #include "FCSRandom.h"
00010 
00011 FCSRandom::FCSRandom(long Seed)
00012 {
00013     m_Seed = Seed;
00014 }
00015 
00016 FCSRandom::~FCSRandom()
00017 {
00018 }
00019 
00020 // This function constructs a larger integral number of out of two 15-bit ones.
00021 int FCSRandom::GetRandomNumber()
00022 {
00023     int one = Rand15(), 
00024         two = Rand15();
00025 
00026     return (one | (two << 15));
00027 }
00028 
00029 void FCSRandom::ReSeed(long Seed)
00030 {
00031     m_Seed = Seed;
00032 }
00033 
00034 int FCSRandom::Rand15()
00035 {
00036     m_Seed = m_Seed * 214013 + 2531011;
00037     return (m_Seed >> 16) & 0x7fff;
00038 }

Generated on Sat Nov 5 11:20:15 2005 for Cpp Freecell Solver by  doxygen 1.4.4