00001 /* AsyncResolverRandom.h - random number generation 00002 00003 By djb, http://cr.yp.to/djbdns.html. The random number generator 00004 along with the rest of the client was placed in the public domain. 00005 00006 Copyright (C) 2004 Mark Weaver 00007 Written by Mark Weaver <mark@npsl.co.uk> 00008 00009 Part of the Open-Win32 library. 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Library General Public 00012 License as published by the Free Software Foundation; either 00013 version 2 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Library General Public License for more details. 00019 00020 You should have received a copy of the GNU Library General Public 00021 License along with this library; if not, write to the 00022 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00023 Boston, MA 02111-1307, USA. 00024 */ 00025 00030 #ifndef OW32_AsyncResolverRandom_h 00031 #define OW32_AsyncResolverRandom_h 00032 00033 #include <OW32/OW32Libs.h> 00034 00035 namespace OW32 00036 { 00037 00042 class OW32_LIB_EXPORT CAsyncResolverRandom 00043 { 00044 public: 00046 CAsyncResolverRandom() {} 00047 00049 CAsyncResolverRandom(const char data[128]) 00050 { 00051 initialise(data); 00052 } 00053 00055 void initialise(const char data[128]); 00056 00061 unsigned int random(unsigned int n); 00062 00063 private: 00064 void surf(); 00065 00066 unsigned int m_seed[32]; 00067 unsigned int m_in[12]; 00068 unsigned int m_out[8]; 00069 int m_outleft; 00070 }; 00071 00072 } // namespace OW32 00073 00074 #endif // OW32_AsyncResolverRandom_h