Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrandom_number.cpp
Go to the documentation of this file.
00001 /*********************************************************************************** 00002 random_number.cpp 00003 00004 * Copyright (c) 1997 00005 * Mark of the Unicorn, Inc. 00006 * 00007 * Permission to use, copy, modify, distribute and sell this software 00008 * and its documentation for any purpose is hereby granted without fee, 00009 * provided that the above copyright notice appear in all copies and 00010 * that both that copyright notice and this permission notice appear 00011 * in supporting documentation. Mark of the Unicorn makes no 00012 * representations about the suitability of this software for any 00013 * purpose. It is provided "as is" without express or implied warranty. 00014 00015 ***********************************************************************************/ 00016 #include "random_number.h" 00017 #include "Prefix.h" 00018 #if defined (EH_NEW_HEADERS) 00019 # include <functional> 00020 # include <cstdlib> 00021 #else 00022 # include <function.h> 00023 # include <stdlib.h> 00024 #endif 00025 00026 unsigned random_number( size_t range ) 00027 { 00028 #if !defined( __SGI_STL ) 00029 if (range == 0) return 0; 00030 return (unsigned)(EH_STD::rand() + EH_STD::rand()) % range; 00031 #else 00032 static EH_STD::subtractive_rng rnd; 00033 if (range==0) return 0; 00034 return rnd(range); 00035 #endif 00036 } 00037 00038 // default base for random container sizes 00039 unsigned random_base = 1000; Generated on Sat May 26 2012 04:34:05 for ReactOS by
1.7.6.1
|