def test_random_state(): import numpy.random as npr # Check with seed state = com._random_state(5) assert_equal(state.uniform(), npr.RandomState(5).uniform()) # Check with random state object state2 = npr.RandomState(10) assert_equal(com._random_state(state2).uniform(), npr.RandomState(10).uniform()) # check with no arg random state assert isinstance(com._random_state(), npr.RandomState) # Error for floats or strings with tm.assertRaises(ValueError): com._random_state('test') with tm.assertRaises(ValueError): com._random_state(5.5)
def test_random_state(): import numpy.random as npr # Check with seed state = com._random_state(5) assert state.uniform() == npr.RandomState(5).uniform() # Check with random state object state2 = npr.RandomState(10) assert com._random_state(state2).uniform() == npr.RandomState(10).uniform() # check with no arg random state assert com._random_state() is np.random # Error for floats or strings with pytest.raises(ValueError): com._random_state('test') with pytest.raises(ValueError): com._random_state(5.5)
def random_color(column): """ Returns a random color represented as a list of length 3""" # GH17525 use common._random_state to avoid resetting the seed rs = _random_state(column) return rs.rand(3).tolist()
def random_color(column): """ Returns a random color represented as a list of length 3""" # GH17525 use common._random_state to avoid resetting the seed rs = com._random_state(column) return rs.rand(3).tolist()