random.hh

Go to the documentation of this file.
00001 // random.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_MISC_RANDOM_HH
00018 # define VCSN_MISC_RANDOM_HH
00019 
00025 # include <vaucanson/algebra/implementation/letter/range.hh>
00026 # include <vaucanson/algebra/implementation/semiring/rational_number.hh>
00027 
00028 namespace utility {
00029 
00031   namespace random {
00032 
00035 
00036     template<typename T>
00037     T generate();
00038 
00043     template<typename T>
00044     T generate(T min, T max);
00045 
00046 
00048     template<>
00049     char generate<char>();
00050 
00052     template<>
00053     char generate<char>(char min, char max);
00054 
00056     char generate_letter();
00057 
00059     char generate_digit();
00060 
00062     template<>
00063     bool generate<bool>();
00064 
00066     template<>
00067     int generate<int>();
00068 
00070     template<>
00071     int generate<int>(int min, int max);
00072 
00074     template<>
00075     unsigned generate<unsigned>();
00076 
00078     template<>
00079     unsigned generate<unsigned>(unsigned min, unsigned max);
00080 
00082     template<>
00083     float generate<float>();
00084 
00086     template<>
00087     float generate<float>(float min, float max);
00088 
00090     template<>
00091     double generate<double>();
00092 
00094     template<>
00095     double generate<double>(double min, double max);
00096 
00098     template <class InputIterator, class OutputIterator>
00099     void sample_n(InputIterator first, InputIterator end,
00100                   OutputIterator out, unsigned n);
00101 
00103     template<>
00104     vcsn::algebra::RationalNumber generate<vcsn::algebra::RationalNumber>();
00105 
00114     template<>
00115     vcsn::algebra::RationalNumber
00116     generate<vcsn::algebra::RationalNumber>
00117     (const vcsn::algebra::RationalNumber min,
00118      const vcsn::algebra::RationalNumber max);
00119 
00121     template <>
00122     std::pair<char, int> generate<std::pair<char, int> >();
00123 
00125 
00126     typedef
00127     vcsn::algebra::static_char_interval<'a', 'z'>
00128     small_alpha_interval_t;
00129 
00130     typedef
00131     vcsn::algebra::static_ranged<char, small_alpha_interval_t>
00132     small_alpha_letter_t;
00133 
00135     template <>
00136     small_alpha_letter_t
00137     generate<small_alpha_letter_t>();
00142   }
00143 }
00144 
00145 
00146 # ifndef VCSN_USE_INTERFACE_ONLY
00147 #  include <vaucanson/misc/random.hxx>
00148 # endif // VCSN_USE_INTERFACE_ONLY
00149 
00150 
00151 #endif // ! VCSN_MISC_RANDOM_HH

Generated on Fri Jul 28 12:18:51 2006 for Vaucanson by  doxygen 1.4.6