diff --git a/CHANGELOG.md b/CHANGELOG.md index e2cb79c..a3e6d73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,30 +2,40 @@ ## [Table of Contents] - [Unreleased](#unreleased) +- [1.1.1](#111---2021-06-07) - [1.1.0](#110---2021-05-03) - [1.0.0](#100---2021-05-02) ## [Unreleased][] +### Added +### Changed +### Removed +### Fixed +## [1.1.1] - 2021-06-07 +### Added +### Changed +### Removed +### Fixed +- Pattern creation: not really random due to using sort + random method. Using an array shuffle now instead. ## [1.1.0] - 2021-05-03 ### Added - Method for pattern creation from harmonic mixing. - Method for pattern application to keys. - ### Changed -- Bugfix at keyNotation for self mapped keys. - ### Removed +### Fixed +- keyNotation for self mapped keys was wrong. ## [1.0.0] - 2021-05-02 ### Added - First release. - ### Changed - ### Removed +### Fixed -[Unreleased]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.0...HEAD +[Unreleased]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.1...HEAD +[1.1.1]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/16b9932...v1.0.0 diff --git a/VERSION b/VERSION index 992977a..9cb4db9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.1.0 \ No newline at end of file +v1.1.1 \ No newline at end of file diff --git a/camelot_wheel_xxx.js b/camelot_wheel_xxx.js index 3076ed8..05a6754 100644 --- a/camelot_wheel_xxx.js +++ b/camelot_wheel_xxx.js @@ -209,8 +209,24 @@ function createHarmonicMixingPattern(playlistLength) { Object.keys(movements).forEach((key) => { pattern = pattern.concat(Array(Math.ceil(playlistLength * movements[key] / 100)).fill(key)); }); - pattern.sort(() => Math.random() - 0.5); - if (pattern.length > playlistLength) {pattern.length = playlistLength;} // finalPlaylistLength is always <= PlaylistLength + // Sort randomly + const result = []; + const len = pattern.length; + for (let i = len - 1; i >= 0; i--) { + const r = Math.floor(Math.random() * (i + 1)); + for (let j = 0, k = 0; j <= len - 1; j++) { + if (typeof result[j] === 'undefined') { + if (k === r) { + result[j] = pattern[i]; + break; + } + k++; + } + } + } + pattern = result; + // Cut to desired length and output + if (len > playlistLength) {pattern.length = playlistLength;} // finalPlaylistLength is always <= PlaylistLength return pattern; }