00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_TOOLS_AUTOMATON_TOOLS_HH
00018 # define VCSN_TOOLS_AUTOMATON_TOOLS_HH
00019 
00020 # include <algorithm>
00021 # include <deque>
00022 # include <vaucanson/automata/concept/automata.hh>
00023 # include <vaucanson/misc/random.hh>
00024 
00025 namespace vcsn
00026 {
00027   namespace tools
00028   {
00029     template <class Auto>
00030     std::deque<typename Auto::hstate_t>
00031     choose_n_states(const Auto& a, unsigned n)
00032     {
00033       typedef typename Auto::hstate_t hstate_t;
00034 
00035       std::deque<typename Auto::hstate_t> s;
00036       std::insert_iterator<std::deque<hstate_t> > i(s, s.begin());
00037       misc::random::sample_n(hstate_t(),
00038                              a.states().begin(),
00039                              a.states().end(),
00040                              i,
00041                              n);
00042       return s;
00043     }
00044   } 
00045 } 
00046 
00047 #endif // ! VCSN_TOOLS_AUTOMATON_TOOLS_HH