Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3034)

Side by Side Diff: Lib/random.py

Issue 14843: support define_macros / undef_macros in setup.cfg
Patch Set: Created 1 year ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/pydoc_data/topics.py ('k') | Lib/sched.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Random variable generators. 1 """Random variable generators.
2 2
3 integers 3 integers
4 -------- 4 --------
5 uniform within range 5 uniform within range
6 6
7 sequences 7 sequences
8 --------- 8 ---------
9 pick random element 9 pick random element
10 pick random sample 10 pick random sample
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 self.seed(x) 90 self.seed(x)
91 self.gauss_next = None 91 self.gauss_next = None
92 92
93 def seed(self, a=None, version=2): 93 def seed(self, a=None, version=2):
94 """Initialize internal state from hashable object. 94 """Initialize internal state from hashable object.
95 95
96 None or no argument seeds from current time or from an operating 96 None or no argument seeds from current time or from an operating
97 system specific randomness source if available. 97 system specific randomness source if available.
98 98
99 For version 2 (the default), all of the bits are used if *a* is a str, 99 For version 2 (the default), all of the bits are used if *a *is a str,
100 bytes, or bytearray. For version 1, the hash() of *a* is used instead. 100 bytes, or bytearray. For version 1, the hash() of *a* is used instead.
101 101
102 If *a* is an int, all bits are used. 102 If *a* is an int, all bits are used.
103 103
104 """ 104 """
105 105
106 if a is None: 106 if a is None:
107 try: 107 try:
108 a = int.from_bytes(_urandom(32), 'big') 108 a = int.from_bytes(_urandom(32), 'big')
109 except NotImplementedError: 109 except NotImplementedError:
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 gauss = _inst.gauss 719 gauss = _inst.gauss
720 betavariate = _inst.betavariate 720 betavariate = _inst.betavariate
721 paretovariate = _inst.paretovariate 721 paretovariate = _inst.paretovariate
722 weibullvariate = _inst.weibullvariate 722 weibullvariate = _inst.weibullvariate
723 getstate = _inst.getstate 723 getstate = _inst.getstate
724 setstate = _inst.setstate 724 setstate = _inst.setstate
725 getrandbits = _inst.getrandbits 725 getrandbits = _inst.getrandbits
726 726
727 if __name__ == '__main__': 727 if __name__ == '__main__':
728 _test() 728 _test()
OLDNEW
« no previous file with comments | « Lib/pydoc_data/topics.py ('k') | Lib/sched.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7