You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@steve.apache.org by hu...@apache.org on 2015/04/02 15:42:43 UTC
svn commit: r1670914 - /steve/trunk/pysteve/lib/plugins/stv.py
Author: humbedooh
Date: Thu Apr 2 13:42:42 2015
New Revision: 1670914
URL: http://svn.apache.org/r1670914
Log:
seed based on time - let's actually make random choice random, why else bother.
Modified:
steve/trunk/pysteve/lib/plugins/stv.py
Modified: steve/trunk/pysteve/lib/plugins/stv.py
URL: http://svn.apache.org/viewvc/steve/trunk/pysteve/lib/plugins/stv.py?rev=1670914&r1=1670913&r2=1670914&view=diff
==============================================================================
--- steve/trunk/pysteve/lib/plugins/stv.py (original)
+++ steve/trunk/pysteve/lib/plugins/stv.py Thu Apr 2 13:42:42 2015
@@ -15,7 +15,7 @@
# limitations under the License.
#
""" STV Voting Plugin """
-import re, json, random
+import re, json, random, time
ELECTED = 1
HOPEFUL = 2
@@ -312,7 +312,7 @@ def exclude_lowest(candidates):
def generate_random(count):
- random.seed(0) ### choose a seed based on input? for now: repeatable.
+ random.seed(time.time()) # Seed based on current time.
while True:
# Generate COUNT values in [0.0, 1.0)
values = [random.random() for x in range(count)]