Skip to content

Commit d903db3

Browse files
committed
faster shuffle()
1 parent 0c36f5d commit d903db3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ signature has changed (now it has two optional boolean arguments: `ignore_spaces
8686
(it now makes use of the new extracted method `asciify()`)
8787
- `is_uuid()` has now a second parameter `allow_hex` that if true, considers as valid UUID hex value
8888
- `uuid()` has now an optional boolean parameter `as_hex` which allows to return UUID string as hex representation
89+
- `shuffle()` is now faster
8990

9091
---
9192

string_utils/manipulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def shuffle(input_string: str) -> str:
370370
raise InvalidInputError(input_string)
371371

372372
# turn the string into a list of chars
373-
chars = sorted(input_string)
373+
chars = list(input_string)
374374

375375
# shuffle the list
376376
random.shuffle(chars)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy