Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Issue #17141: random.vonmisesvariate() no more hangs for large kappas. | Serhiy Storchaka | 2013-02-10 | 1 | -8/+6 |
| | |||||
* | Issue #17149: Fix random.vonmisesvariate to always return results in [0, ↵ | Mark Dickinson | 2013-02-10 | 1 | -2/+2 |
| | | | | 2*math.pi]. | ||||
* | Code simplification suggested by Sven Marnach. | Raymond Hettinger | 2011-06-25 | 1 | -5/+3 |
| | |||||
* | Minor code cleanup. | Raymond Hettinger | 2011-05-18 | 1 | -1/+1 |
| | |||||
* | #11848: replace dead link in random.betavariate comment. | Ezio Melotti | 2011-04-15 | 1 | -1/+1 |
| | |||||
* | Issue 10787: Document the probability density function for random.gammavariate. | Raymond Hettinger | 2011-03-22 | 1 | -0/+6 |
| | |||||
* | Issue 9816: Random.jumpahead(n) didn't work well for small values of n. | Raymond Hettinger | 2010-09-10 | 1 | -0/+13 |
| | |||||
* | Remove outdated XXX comment. Mapping support was removed for 3.x. | Raymond Hettinger | 2010-09-06 | 1 | -9/+0 |
| | |||||
* | Issue 6261: Clarify behavior of random.uniform(). | Raymond Hettinger | 2009-06-11 | 1 | -1/+1 |
| | |||||
* | Issue #4869: clarify documentation for random.expovariate. | Mark Dickinson | 2009-01-07 | 1 | -3/+5 |
| | |||||
* | getrandombits is actually getrandbits | Benjamin Peterson | 2008-07-30 | 1 | -3/+3 |
| | |||||
* | Adopt Nick's suggestion for useful default arguments. | Raymond Hettinger | 2008-03-23 | 1 | -4/+5 |
| | | | | Clean-up floating point issues by adding true division and float constants. | ||||
* | Issue 1681432: Add triangular distribution the random module. | Raymond Hettinger | 2008-03-23 | 1 | -1/+23 |
| | |||||
* | Issue #1727780: Support loading pickles of random.Random objects created | Martin v. Löwis | 2007-12-03 | 1 | -2/+13 |
| | | | | | | on 32-bit systems on 64-bit systems, and vice versa. As a consequence of the change, Random pickles created by Python 2.6 cannot be loaded in Python 2.5. | ||||
* | SF# 1635892: Fix docs for betavariate's input parameters . | Raymond Hettinger | 2007-01-19 | 1 | -1/+1 |
| | |||||
* | Bug #1590891: random.randrange don't return correct value for big number | Raymond Hettinger | 2006-12-20 | 1 | -1/+1 |
| | | | | Needs to be backported. | ||||
* | shuffle() doscstring: Removed warning about sequence length | Tim Peters | 2006-06-10 | 1 | -12/+6 |
| | | | | | | | | | versus generator period. While this was a real weakness of the older WH generator for lists with just a few dozen elements, and so could potentially bite the naive ;-), the Twister should show excellent behavior up to at least 600 elements. Module docstring: reflowed some jarringly short lines. | ||||
* | Another crack at bug #1460340: make random.sample(dict) | Tim Peters | 2006-04-01 | 1 | -3/+14 |
| | | | | work, this time by ugly brute force. | ||||
* | SF bug #1460340: random.sample can raise KeyError | Raymond Hettinger | 2006-03-29 | 1 | -10/+11 |
| | | | | Fix the hit and miss style of testing for sets and dicts. | ||||
* | Whitespace normalization (via reindent.py). | Tim Peters | 2005-08-26 | 1 | -1/+1 |
| | |||||
* | Implement random.sample() using sets instead of dicts. | Raymond Hettinger | 2005-08-19 | 1 | -9/+13 |
| | |||||
* | SF patch #1191489: Simplify logic in random.py | Raymond Hettinger | 2005-04-30 | 1 | -9/+10 |
| | |||||
* | Removed unused line. | Raymond Hettinger | 2005-01-03 | 1 | -1/+0 |
| | |||||
* | Use floor division operator. | Raymond Hettinger | 2004-09-27 | 1 | -2/+2 |
| | |||||
* | SF #1027105: HardwareRandom should be renamed OSRandom | Raymond Hettinger | 2004-09-13 | 1 | -11/+13 |
| | | | | | | Renamed the new generator at Trevor's recommendation. The name HardwareRandom suggested a bit more than it delivered (no radioactive decay detectors or such). | ||||
* | Fulfill Martin's request to use try/except rather than a "look before | Raymond Hettinger | 2004-09-05 | 1 | -17/+8 |
| | | | | you leap" approach. Makes the early call to os.urandom() unnecessary. | ||||
* | SF bug #1022010: Import random fails | Raymond Hettinger | 2004-09-03 | 1 | -1/+2 |
| | | | | | * trap NotImplementedError raised by os.urandom calls when not available on a particular system. | ||||
* | HardwareRandom: Go back to multiplying by 2**-BPF instead of using | Tim Peters | 2004-08-31 | 1 | -2/+3 |
| | | | | | | | | | | ldexp. Both methods are exact, and return the same results. Turns out multiplication is a few (but just a few) percent faster on my box. They're both significantly faster than using struct with a Q format to convert bytes to a 64-bit long (struct.unpack() appears to lose due to the tuple creation/teardown overhead), and calling _hexlify is significantly faster than doing bytes.encode('hex'). So we appear to have hit a local minimum (wrt speed) here. | ||||
* | Take advantage of the math library's ldexp for assembling a float by | Raymond Hettinger | 2004-08-31 | 1 | -5/+3 |
| | | | | | | | components without division and without roundoff error for properly sized mantissas (i.e. on systems with 53 or more mantissa bits per float). Eliminates the previous implementation's rounding bias as aptly demonstrated by Tim Peters. | ||||
* | Teach the random module about os.urandom(). | Raymond Hettinger | 2004-08-30 | 1 | -8/+62 |
| | | | | | * Use it for seeding when it is available. * Provide an alternate generator based on it. | ||||
* | Fix typo in comment. | Raymond Hettinger | 2004-06-07 | 1 | -1/+1 |
| | |||||
* | SF bug #964230: random.choice([]) should return more intelligible exception | Raymond Hettinger | 2004-06-05 | 1 | -1/+1 |
| | | | | Add a comment to make the traceback less mysterious. | ||||
* | Reflow long line. | Jeremy Hylton | 2004-02-23 | 1 | -6/+6 |
| | |||||
* | Whitespace normalization. | Tim Peters | 2004-01-18 | 1 | -1/+1 |
| | |||||
* | Implement and apply PEP 322, reverse iteration | Raymond Hettinger | 2003-11-06 | 1 | -1/+1 |
| | |||||
* | Minor fixup. "Random" was listed twice in __all__. | Raymond Hettinger | 2003-10-12 | 1 | -2/+1 |
| | |||||
* | SF bug #812202: randint is always even | Raymond Hettinger | 2003-10-05 | 1 | -10/+54 |
| | | | | | | | * Added C coded getrandbits(k) method that runs in linear time. * Call the new method from randrange() for ranges >= 2**53. * Adds a warning for generators not defining getrandbits() whenever they have a call to randrange() with too large of a population. | ||||
* | SF bug #801342: Bug (documentation or real, your choice) in random.sample. | Raymond Hettinger | 2003-09-06 | 1 | -0/+4 |
| | | | | | | | | | | | | random.sample() uses one of two algorithms depending on the ratio of the sample size to the population size. One of the algorithms accepted any iterable population argument so long as it defined __len__(). The other had a stronger requirement that the population argument be indexable. While it met the documentation specifications which insisted that the population argument be a sequence, it made random.sample() less usable with sets. So, the second algorithm was modified to coerce non-indexable iterables and dictionaries into a tuple before proceeding. | ||||
* | Eliminate unnecessary eval() in tests | Raymond Hettinger | 2003-08-30 | 1 | -19/+18 |
| | |||||
* | SF bug #778964: bad seed in python 2.3 random | Raymond Hettinger | 2003-08-09 | 1 | -0/+3 |
| | | | | | | | The default seed is time.time(). Multiplied by 256 before truncating so that fractional seconds are used. This way, two successive calls to random.seed() are much more likely to produce different sequences. | ||||
* | Removed deprecated functions | Raymond Hettinger | 2003-08-05 | 1 | -49/+2 |
| | |||||
* | SF bug #759889: Pickling of Random is broken | Raymond Hettinger | 2003-06-24 | 1 | -0/+3 |
| | | | | | * Implement __reduce__() to support pickling. * Add a test case to prove a successful roundtrip through pickle. | ||||
* | randrange(): Repaired my overly optimistic rewrite, and added comments | Tim Peters | 2003-06-19 | 1 | -1/+13 |
| | | | | explaining what's wrong with the two simpler variants. | ||||
* | randrange(): 2.3 can no longer raises OverflowError on an int() call, so | Tim Peters | 2003-06-19 | 1 | -10/+1 |
| | | | | | | some of this code because useless, and (worse) could return a long instead of int (in Zope that's important, because a long can't be used as a key in an IOBTree or IIBTree). | ||||
* | SF bug #753602: random.sample not properly documented | Raymond Hettinger | 2003-06-13 | 1 | -4/+5 |
| | | | | | The docs were fine but the "int=int" in the function call was both ugly and confusing. Moved it inside the body of the function definition. | ||||
* | 'sum' is no longer a good variable name. Use 'total' instead. | Raymond Hettinger | 2003-05-24 | 1 | -3/+3 |
| | |||||
* | * Migrate sample distribution test from random.py to test_random.py. | Raymond Hettinger | 2003-01-17 | 1 | -5/+0 |
| | | | | * Use Sets module to more clearly articulate a couple of tests. | ||||
* | Much clearer when super() is used. | Raymond Hettinger | 2003-01-07 | 1 | -5/+5 |
| | |||||
* | Move the statistical tests for four distributions into the unittest suite. | Raymond Hettinger | 2003-01-05 | 1 | -3/+0 |
| | |||||
* | Correct long standing bugs in the methods for random distributions. | Raymond Hettinger | 2003-01-04 | 1 | -4/+6 |
| | | | | | | | The range of u=random() is [0,1), so log(u) and 1/x can fail. Fix by setting u=1-random() or by reselecting for a usable value. Will backport. |