- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# 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, 2006 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 vcsn {
    00029   namespace misc {
    00030
    00032     namespace random {
    00033
    00036
    00037       template<typename T>
    00038       T generate ();
    00039
    00044       template<typename T>
    00045       T generate (T min, T max);
    00046
    00047
    00049       template<>
    00050       char generate<char> ();
    00051
    00053       template<>
    00054       char generate<char> (char min, char max);
    00055
    00057       char generate_letter ();
    00058
    00060       char generate_digit ();
    00061
    00063       template<>
    00064       bool generate<bool> ();
    00065
    00067       template<>
    00068       int generate<int> ();
    00069
    00071       template<>
    00072       int generate<int> (int min, int max);
    00073
    00075       template<>
    00076       unsigned generate<unsigned> ();
    00077
    00079       template<>
    00080       unsigned generate<unsigned> (unsigned min, unsigned max);
    00081
    00083       template<>
    00084       float generate<float> ();
    00085
    00087       template<>
    00088       float generate<float> (float min, float max);
    00089
    00091       template<>
    00092       double generate<double> ();
    00093
    00095       template<>
    00096       double generate<double> (double min, double max);
    00097
    00099       template <class InputIterator, class OutputIterator>
    00100       void sample_n (InputIterator first, InputIterator end,
    00101                      OutputIterator out, unsigned n);
    00102
    00104       template<>
    00105       vcsn::algebra::RationalNumber generate<vcsn::algebra::RationalNumber> ();
    00106
    00115       template<>
    00116       vcsn::algebra::RationalNumber
    00117       generate<vcsn::algebra::RationalNumber>
    00118       (const vcsn::algebra::RationalNumber min,
    00119        const vcsn::algebra::RationalNumber max);
    00120
    00122       template <>
    00123       std::pair<char, int> generate<std::pair<char, int> > ();
    00124
    00126
    00127       typedef
    00128       vcsn::algebra::static_char_interval<'a', 'z'>
    00129       small_alpha_interval_t;
    00130
    00131       typedef
    00132       vcsn::algebra::static_ranged<char, small_alpha_interval_t>
    00133       small_alpha_letter_t;
    00134
    00136       template <>
    00137       small_alpha_letter_t
    00138       generate<small_alpha_letter_t> ();
    00143     }
    00144   } // end of namespace misc.
    00145 } // end of namespace vcsn.
    00146
    00147
    00148 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00149 #  include <vaucanson/misc/random.hxx>
    00150 # endif // VCSN_USE_INTERFACE_ONLY
    00151
    00152
    00153 #endif // ! VCSN_MISC_RANDOM_HH