mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-06 14:24:09 +00:00
fix algorithm: bogo_sort, bozo_sort
This commit is contained in:
parent
aace49ac65
commit
f3b405ad0f
75 changed files with 634 additions and 776 deletions
|
@ -8,15 +8,10 @@
|
|||
#include <sprout/container/functions.hpp>
|
||||
#include <sprout/iterator/operation.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/utility/pair.hpp>
|
||||
#include <sprout/algorithm/fixed/result_of.hpp>
|
||||
#include <sprout/algorithm/fixed/swap_element.hpp>
|
||||
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||
# include <sprout/random/uniform_smallint.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_smallint
|
||||
#else
|
||||
# include <sprout/random/uniform_int_distribution.hpp>
|
||||
# define SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION sprout::random::uniform_int_distribution
|
||||
#endif
|
||||
#include <sprout/workaround/detail/uniform_int_distribution.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace fixed {
|
||||
|
@ -39,7 +34,9 @@ namespace sprout {
|
|||
make_random_swap_indexes(std::ptrdiff_t n, UniformRandomNumberGenerator&& g) {
|
||||
return n > 1
|
||||
? sprout::fixed::detail::make_random_swap_indexes_1(
|
||||
SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(sprout::forward<UniformRandomNumberGenerator>(g))
|
||||
SPROUT_WORKAROUND_DETAIL_UNIFORM_INT_DISTRIBUTION<std::ptrdiff_t>(0, n - 1)(
|
||||
sprout::forward<UniformRandomNumberGenerator>(g)
|
||||
)
|
||||
)
|
||||
: sprout::array<std::ptrdiff_t, 2>{{}}
|
||||
;
|
||||
|
@ -88,6 +85,4 @@ namespace sprout {
|
|||
using sprout::fixed::random_swap;
|
||||
} // namespace sprout
|
||||
|
||||
#undef SPROUT_WORKAROUND_UNIFORM_INT_DISTRIBUTION
|
||||
|
||||
#endif // #ifndef SPROUT_ALGORITHM_FIXED_RANDOM_SWAP_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue