You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -594,28 +594,28 @@ Since the base class **BaseRandom** inherits from the built-in class `random.Ran
594
594
**betavariate**(self, alpha, beta)
595
595
Beta distribution.
596
596
597
-
Conditions on the parameters are alpha > 0 and beta > 0.
597
+
Conditions on the parameters are `alpha > 0` and `beta > 0`.
598
598
Returned values range between 0 and 1.
599
599
600
600
601
601
**binomialvariate**(self, n=1, p=0.5)
602
-
Binomial distribution. Return the number of successes for n independent trials with the probability of success in each trial being p:
602
+
Binomial distribution. Return the number of successes for `n` independent trials with the probability of success in each trial being `p`:
603
603
604
604
Mathematically equivalent to:
605
605
606
606
sum(random() < p for i in range(n))
607
607
608
-
The number of trials n should be a non-negative integer. The probability of success p should be between 0.0 <= p <= 1.0. The result is an integer in the range 0 <= X <= n. This built-in, method has been added since Python 3.12. **PyRandLIb** implements it also for all former versions of Python: -3.6, -3.9, -3.10, and -3.11.
608
+
The number of trials `n` should be a non-negative integer. The probability of success `p` should be between `0.0 <= p <= 1.0`. The result is an integer in the range `0 <= X <= n`. This built-in method has been added since Python 3.12. **PyRandLIb** implements it also for all former versions of Python: -3.6, -3.9, -3.10, and -3.11.
609
609
610
610
611
611
**choice**(self, seq)
612
-
Chooses a random element from a non-empty sequence. 'seq' has to be non empty.
612
+
Chooses a random element from a non-empty sequence. `seq` has to be non empty.
Returns a *k* sized list of elements chosen from the population, with replacement. If the population is empty, raises IndexError.
616
+
Returns a `k` sized list of elements chosen from the population, with replacement. If the population is empty, raises `IndexError`.
617
617
618
-
If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using `itertools.accumulate()`).
618
+
If a `weights` sequence is specified, selections are made according to the relative weights. Alternatively, if a `cum_weights` sequence is given, the selections are made according to the cumulative weights (perhaps computed using `itertools.accumulate()`).
619
619
For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`.
620
620
Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
621
621
@@ -631,7 +631,7 @@ Exponential distribution.
631
631
632
632
`lambd` is 1.0 divided by the desired mean. It should be nonzero. (The parameter should be called "lambda", but this is a reserved word in Python).
633
633
Returned values range from 0 to positive infinity if `lambd` is positive, and from negative infinity to 0 if `lambd` is negative.
634
-
Since Python 3.12, the parameter `lambd` gets a default value in this built-in method. **PyRandLib** defines then this method for all former versions of Pyhton : -3.6, -3.9, -3.10 and -3.11.
634
+
Since Python 3.12, the parameter `lambd` gets a default value in this built-in method. **PyRandLib** defines then this method for all former versions of Python : -3.6, -3.9, -3.10 and -3.11.
635
635
636
636
637
637
**gammavariate**(self, alpha, beta)
@@ -643,8 +643,8 @@ Conditions on the parameters are `alpha` > 0 and `beta` > 0.
643
643
**gauss**(self, mu, sigma)
644
644
Gaussian distribution.
645
645
646
-
mu is the mean, and sigma is the standard deviation.
647
-
This is slightly faster than the normalvariate() function.
646
+
`mu` is the mean, and `sigma` is the standard deviation.
647
+
This is slightly faster than the `normalvariate()` function.
648
648
649
649
Not thread-safe without a lock around calls.
650
650
@@ -675,7 +675,7 @@ Pareto distribution. `alpha` is the shape parameter.
675
675
676
676
677
677
**randint**(self, a, b)
678
-
Returns a random integer in range [a, b], including both end points.
678
+
Returns a random integer in range `[a, b]`, including both end points.
679
679
680
680
681
681
**randrange**(self, stop)
@@ -710,9 +710,9 @@ Restores internal state from object returned by `getstate()`.
710
710
711
711
712
712
**shuffle**(self, x, random=None)
713
-
Shuffle the sequence x in place. Returns None.
713
+
Shuffle the sequence `x` in place. Returns None.
714
714
715
-
The optional argument `random` is a 0-argument function returning a random float in [0.0, 1.0); by default, this is the function random().
715
+
The optional argument `random` is a 0-argument function returning a random float in `[0.0, 1.0)`; by default, this is the function random().
716
716
717
717
To shuffle an immutable sequence and return a new shuffled list, use `sample(x, k=len(x))` instead.
718
718
@@ -728,7 +728,7 @@ see [http://en.wikipedia.org/wiki/Triangular_distribution](http://en.wikipedia.o
728
728
729
729
730
730
**uniform**(self, a, b)
731
-
Gets a random number in the range [`a`, `b`) or [`a`, `b`] depending on rounding.
731
+
Gets a random number in the range `[a, b)` or `[a, b]` depending on rounding.
0 commit comments