Skip to content

Commit

Permalink
use datetime string for random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
bmos committed Mar 11, 2024
1 parent ed908f7 commit 39341d8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions petl/util/random.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
from __future__ import absolute_import, print_function, division


import datetime
import random
import time
from collections import OrderedDict
from functools import partial
from petl.compat import xrange, text_type


from petl.util.base import Table


Expand Down Expand Up @@ -52,7 +50,7 @@ def __init__(self, numflds=5, numrows=100, wait=0, seed=None):
self.numrows = numrows
self.wait = wait
if seed is None:
self.seed = datetime.datetime.now()
self.seed = datetime.datetime.now().isoformat()
else:
self.seed = seed

Expand All @@ -77,7 +75,7 @@ def __iter__(self):
yield tuple(random.random() for n in range(nf))

def reseed(self):
self.seed = datetime.datetime.now()
self.seed = datetime.datetime.now().isoformat()


def dummytable(numrows=100,
Expand Down Expand Up @@ -154,7 +152,7 @@ def __init__(self, numrows=100, fields=None, wait=0, seed=None):
else:
self.fields = OrderedDict(fields)
if seed is None:
self.seed = datetime.datetime.now()
self.seed = datetime.datetime.now().isoformat()
else:
self.seed = seed

Expand All @@ -181,4 +179,4 @@ def __iter__(self):
yield tuple(fields[f]() for f in fields)

def reseed(self):
self.seed = datetime.datetime.now()
self.seed = datetime.datetime.now().isoformat()

0 comments on commit 39341d8

Please sign in to comment.