diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-26 03:01:04 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-26 03:01:04 +0300 |
commit | fa9171c4c8cc79cde1facf65644728f5ba5a8917 (patch) | |
tree | da08d4de1b6cff462ecfd4b54a3b4f47ae80b802 /algorithms/impl | |
parent | add heuristic to derive time units (diff) | |
download | sorting-algorithms-fa9171c4c8cc79cde1facf65644728f5ba5a8917.tar.gz sorting-algorithms-fa9171c4c8cc79cde1facf65644728f5ba5a8917.zip |
quicksort: seed RNG
Diffstat (limited to 'algorithms/impl')
-rw-r--r-- | algorithms/impl/quicksort.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/algorithms/impl/quicksort.py b/algorithms/impl/quicksort.py index ddc8269..9230187 100644 --- a/algorithms/impl/quicksort.py +++ b/algorithms/impl/quicksort.py @@ -2,11 +2,13 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -from random import randrange +from random import randrange, seed import sys from ..algorithm import SortingAlgorithm +seed() + def _partition(xs, beg, end, select_pivot): pivot = select_pivot(xs, beg, end) xs[pivot], xs[end] = xs[end], xs[pivot] |