Module RDRandom
[hide private]
[frames] | no frames]

Source Code for Module RDRandom

 1  # $Id: RDRandom.py 1528 2010-09-26 17:04:37Z glandrum $ 
 2  # 
 3  #  Copyright (C) 2003-2006  Greg Landrum and Rational Discovery LLC 
 4  # 
 5  #   @@ All Rights Reserved @@ 
 6  #  This file is part of the RDKit. 
 7  #  The contents are covered by the terms of the BSD license 
 8  #  which is included in the file license.txt, found at the root 
 9  #  of the RDKit source tree. 
10  # 
11  """ making random numbers consistent so we get good regressions 
12   
13  """ 
14   
15  import sys 
16   
17  import random as _random 
18  if sys.hexversion >= 0x20303f0: 
19    _randGen = _random.WichmannHill() 
20    random = _randGen.random 
21    randrange = _randGen.randrange 
22 - def seed(val):
23 global _randGen,random,randrange 24 _randGen = _random.WichmannHill() 25 _randGen.whseed(val) 26 random = _randGen.random 27 randrange = _randGen.randrange
28 else: 29 random = _random.random 30 randrange = _random.randrange 31 seed = _random.whseed 32