Added getRandInterval funstion. Full support of dictionaries with multiple definitions of one word.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "crossgen.hpp"
|
||||
|
||||
//TODO: fix crash when genereates crossword in debug mode with floating-point error
|
||||
|
||||
const wxChar CELL_CLEAR = wxT('+');
|
||||
const wxChar CELL_BORDER = wxT('-');
|
||||
|
||||
@@ -51,4 +51,9 @@ bool procCross(
|
||||
void generateCross(const GridType &grid, const AllWordsType &words,
|
||||
const CharsTransType &trans_type, std::vector<wxString> &words_out);
|
||||
|
||||
template <class InputIterator>
|
||||
InputIterator getRandInterval(const InputIterator first, const InputIterator last){
|
||||
auto d = std::distance(first, last);
|
||||
return next(first, rand() % d);
|
||||
}
|
||||
#endif // CROSSGEN_HPP
|
||||
|
||||
Reference in New Issue
Block a user