diff options
author | Andreas Kling <kling@serenityos.org> | 2023-03-06 17:59:07 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-06 23:46:36 +0100 |
commit | d57b09b7cf4f9850c15b2f74e0ec1d77354eca4d (patch) | |
tree | dc290f5e19aa48fd758b96ebd5538b0eda6f8363 /AK/Random.h | |
parent | 7369d0ab5f93b3b083e030bef64486b02cafb3d5 (diff) | |
download | serenity-d57b09b7cf4f9850c15b2f74e0ec1d77354eca4d.zip |
AK: Remove specialized shuffle for NonnullPtrVector
Diffstat (limited to 'AK/Random.h')
-rw-r--r-- | AK/Random.h | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/AK/Random.h b/AK/Random.h index 3d68bfa5dc..1fc7c81c03 100644 --- a/AK/Random.h +++ b/AK/Random.h @@ -63,19 +63,6 @@ inline void shuffle(Collection& collection) } } -// shuffle() implementation for NonnullPtrVector, since its operator[] returns a reference to the pointed-at value -// instead of the pointer itself. -template<typename Collection> -requires(requires(Collection collection) { collection.ptr_at(0); }) -inline void shuffle(Collection& collection) -{ - // Fisher-Yates shuffle - for (size_t i = collection.size() - 1; i >= 1; --i) { - size_t j = get_random_uniform(i + 1); - AK::swap(collection.ptr_at(i), collection.ptr_at(j)); - } -} - } #if USING_AK_GLOBALLY |