From d1a7edec90405c1a5fb1160a744cd6e921a31086 Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Tue, 10 Sep 2024 20:18:13 +0200 Subject: [PATCH 1/3] bool --- include/sst/basic-blocks/dsp/RNG.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/sst/basic-blocks/dsp/RNG.h b/include/sst/basic-blocks/dsp/RNG.h index eef4d16..865d5d2 100644 --- a/include/sst/basic-blocks/dsp/RNG.h +++ b/include/sst/basic-blocks/dsp/RNG.h @@ -36,13 +36,13 @@ struct RNG { RNG() : g(std::chrono::system_clock::now().time_since_epoch().count()), dg(525600 + 8675309), - pm1(-1.f, 1.f), z1(0.f, 1.f), gauss(0.f, .33333f), u32(0, 0xFFFFFFFF) + pm1(-1.f, 1.f), z1(0.f, 1.f), gauss(0.f, .33333f), u32(0, 0xFFFFFFFF), b(.5) { } RNG(uint32_t seed) : g(seed), dg(525600 + 8675309), pm1(-1.f, 1.f), z1(0.f, 1.f), gauss(0.f, .33333f), - u32(0, 0xFFFFFFFF) + u32(0, 0xFFFFFFFF), b(.5) { } @@ -72,6 +72,8 @@ struct RNG std::uniform_int_distribution intdist(min, max - 1); return intdist(g); } + + inline bool boolean() { return b(g); } inline float forDisplay() { return pm1(dg); } @@ -81,6 +83,7 @@ struct RNG std::uniform_real_distribution pm1, z1; std::normal_distribution gauss; std::uniform_int_distribution u32; + std::bernoulli_distribution b; }; } // namespace sst::basic_blocks::dsp From b291d2fb40923a71d1e68622b7ef06d5b51a171d Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Tue, 10 Sep 2024 20:21:12 +0200 Subject: [PATCH 2/3] vlang-formst --- include/sst/basic-blocks/dsp/RNG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sst/basic-blocks/dsp/RNG.h b/include/sst/basic-blocks/dsp/RNG.h index 865d5d2..c3bfdd6 100644 --- a/include/sst/basic-blocks/dsp/RNG.h +++ b/include/sst/basic-blocks/dsp/RNG.h @@ -72,7 +72,7 @@ struct RNG std::uniform_int_distribution intdist(min, max - 1); return intdist(g); } - + inline bool boolean() { return b(g); } inline float forDisplay() { return pm1(dg); } From e4f736b2d954d3dd19f71a439b2d06fcc3632a31 Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Tue, 10 Sep 2024 20:26:31 +0200 Subject: [PATCH 3/3] what --- include/sst/basic-blocks/dsp/RNG.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sst/basic-blocks/dsp/RNG.h b/include/sst/basic-blocks/dsp/RNG.h index c3bfdd6..cf51d64 100644 --- a/include/sst/basic-blocks/dsp/RNG.h +++ b/include/sst/basic-blocks/dsp/RNG.h @@ -71,7 +71,7 @@ struct RNG { std::uniform_int_distribution intdist(min, max - 1); return intdist(g); - } + } // clang-format problem? Why? inline bool boolean() { return b(g); }