Skip to content

Instantly share code, notes, and snippets.

@Answeror
Created September 24, 2012 12:19
Show Gist options
  • Select an option

  • Save Answeror/3775675 to your computer and use it in GitHub Desktop.

Select an option

Save Answeror/3775675 to your computer and use it in GitHub Desktop.
deterministic testing with numpy.random.
from numpy import random
from numpy.random import rand
class TestRandomly(object):
def setUp(self):
self.state = random.get_state()
random.seed(0)
def tearDown(self):
random.set_state(self.state)
def test_adjust_start_point(self):
# do something with rand()
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment