mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add sprout/random/default_random_engine.hpp
fix sprout/functional/bit_not.hpp
This commit is contained in:
parent
37775f9280
commit
2b8a8662af
9 changed files with 39 additions and 18 deletions
|
@ -19,7 +19,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
|
@ -29,7 +29,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
|
@ -41,7 +41,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
sprout::sub(arr1, 1, 4),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
|
@ -55,7 +55,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
sprout::sub(arr1, 1, 4),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
sorted,
|
||||
|
@ -74,7 +74,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
|
@ -85,7 +85,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
|
@ -98,7 +98,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::bogo_sort(
|
||||
sprout::sub(arr1, 1, 4),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
|
@ -113,7 +113,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto sorted = sprout::fit::bogo_sort(
|
||||
sprout::sub(arr1, 1, 4),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED),
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED),
|
||||
testspr::less<int>()
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::equal(
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace testspr {
|
|||
using namespace sprout;
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED);
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
||||
// ソート
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace testspr {
|
|||
}
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 5>{{5, 1, 4, 2, 3}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED);
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
||||
// ソート
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto shuffled = sprout::shuffle(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::is_permutation(
|
||||
shuffled,
|
||||
|
@ -29,7 +29,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto shuffled = sprout::fit::shuffle(
|
||||
arr1,
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::is_permutation(
|
||||
shuffled,
|
||||
|
@ -41,7 +41,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto shuffled = sprout::shuffle(
|
||||
sprout::sub(arr1, 2, 8),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::is_permutation(
|
||||
shuffled,
|
||||
|
@ -55,7 +55,7 @@ namespace testspr {
|
|||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto shuffled = sprout::fit::shuffle(
|
||||
sprout::sub(arr1, 2, 8),
|
||||
sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED)
|
||||
sprout::random::default_random_engine(SPROUT_UNIQUE_SEED)
|
||||
);
|
||||
TESTSPR_DOUBLE_ASSERT(testspr::is_permutation(
|
||||
shuffled,
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace testspr {
|
|||
using namespace sprout;
|
||||
{
|
||||
SPROUT_STATIC_CONSTEXPR auto arr1 = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::hellekalek1995(SPROUT_UNIQUE_SEED);
|
||||
SPROUT_STATIC_CONSTEXPR auto g = sprout::random::default_random_engine(SPROUT_UNIQUE_SEED);
|
||||
|
||||
// シャッフル
|
||||
{
|
||||
|
|
|
@ -46,11 +46,13 @@
|
|||
#ifndef SPROUT_CONFIG_USE_SSCRISK_CEL
|
||||
# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT <sprout/functional/functor.hpp>
|
||||
# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT <sprout/algorithm/non_modifying.hpp>
|
||||
# define HDR_NUMERIC_SSCRISK_CEL_OR_SPROUT <sprout/numeric/non_modifying.hpp>
|
||||
# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT <sprout/iterator/operation.hpp>
|
||||
# define NS_SSCRISK_CEL_OR_SPROUT sprout
|
||||
#else // #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL
|
||||
# define HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT <sscrisk/cel/functional.hpp>
|
||||
# define HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT <sscrisk/cel/algorithm.hpp>
|
||||
# define HDR_NUMERIC_SSCRISK_CEL_OR_SPROUT <sscrisk/cel/numeric.hpp>
|
||||
# define HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT <sscrisk/cel/iterator.hpp>
|
||||
# define NS_SSCRISK_CEL_OR_SPROUT sscrisk::cel
|
||||
#endif // #ifndef SPROUT_CONFIG_USE_SSCRISK_CEL
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace sprout {
|
|||
typedef T result_type;
|
||||
public:
|
||||
SPROUT_CONSTEXPR T operator()(T const& x) const {
|
||||
return !x;
|
||||
return ~x;
|
||||
}
|
||||
};
|
||||
} // namespace sprout
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <sprout/random/binomial_distribution.hpp>
|
||||
#include <sprout/random/geometric_distribution.hpp>
|
||||
#include <sprout/random/normal_distribution.hpp>
|
||||
#include <sprout/random/default_random_engine.hpp>
|
||||
#include <sprout/random/variate_generator.hpp>
|
||||
#include <sprout/random/random_result.hpp>
|
||||
#include <sprout/random/random_iterator.hpp>
|
||||
|
|
18
sprout/random/default_random_engine.hpp
Normal file
18
sprout/random/default_random_engine.hpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#ifndef SPROUT_RANDOM_DEFAULT_RANDOM_ENGINE_HPP
|
||||
#define SPROUT_RANDOM_DEFAULT_RANDOM_ENGINE_HPP
|
||||
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/random/linear_congruential.hpp>
|
||||
|
||||
namespace sprout {
|
||||
namespace random {
|
||||
//
|
||||
// default_random_engine
|
||||
//
|
||||
typedef sprout::random::minstd_rand0 default_random_engine;
|
||||
} // namespace random
|
||||
|
||||
using sprout::random::default_random_engine;
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_RANDOM_DEFAULT_RANDOM_ENGINE_HPP
|
|
@ -6,7 +6,7 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/uuid/uuid.hpp>
|
||||
#include <sprout/random/inversive_congruential.hpp>
|
||||
#include <sprout/random/default_random_engine.hpp>
|
||||
#include <sprout/random/uniform_int_distribution.hpp>
|
||||
#include <sprout/random/variate_generator.hpp>
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace sprout {
|
|||
//
|
||||
// random_generator
|
||||
//
|
||||
typedef sprout::uuids::basic_random_generator<sprout::random::hellekalek1995> random_generator;
|
||||
typedef sprout::uuids::basic_random_generator<sprout::random::default_random_engine> random_generator;
|
||||
} // namespace uuids
|
||||
} // namespace sprout
|
||||
|
||||
|
|
Loading…
Reference in a new issue