@@ -133,6 +133,7 @@ def beta(a, b, size=None):
133
133
Examples
134
134
--------
135
135
Draw samples from the distribution:
136
+
136
137
>>> a, b = .4, .5 # alpha, beta
137
138
>>> s = dpnp.random.beta(a, b, 1000)
138
139
@@ -170,6 +171,7 @@ def binomial(n, p, size=None):
170
171
Examples
171
172
--------
172
173
Draw samples from the distribution:
174
+
173
175
>>> n, p = 10, .5 # number of trials, probability of each trial
174
176
>>> s = dpnp.random.binomial(n, p, 1000)
175
177
# result of flipping a coin 10 times, tested 1000 times.
@@ -297,6 +299,7 @@ def exponential(scale=1.0, size=None):
297
299
Examples
298
300
--------
299
301
Draw samples from the distribution:
302
+
300
303
>>> scale = .5 # alpha
301
304
>>> s = dpnp.random.exponential(scale, 1000)
302
305
@@ -366,6 +369,7 @@ def gamma(shape, scale=1.0, size=None):
366
369
Examples
367
370
--------
368
371
Draw samples from the distribution:
372
+
369
373
>>> shape, scale = 0, 0.1 # shape and scale
370
374
>>> s = dpnp.random.gamma(shape, scale, 1000)
371
375
@@ -404,6 +408,7 @@ def geometric(p, size=None):
404
408
--------
405
409
Draw ten thousand values from the geometric distribution,
406
410
with the probability of an individual success equal to 0.35:
411
+
407
412
>>> z = dpnp.random.geometric(p=0.35, size=10000)
408
413
409
414
"""
@@ -436,6 +441,7 @@ def gumbel(loc=0.0, scale=1.0, size=None):
436
441
Examples
437
442
--------
438
443
Draw samples from the distribution:
444
+
439
445
>>> mu, beta = 0, 0.1 # location and scale
440
446
>>> s = dpnp.random.gumbel(mu, beta, 1000)
441
447
@@ -472,6 +478,7 @@ def hypergeometric(ngood, nbad, nsample, size=None):
472
478
Examples
473
479
--------
474
480
Draw samples from the distribution:
481
+
475
482
>>> ngood, nbad, nsamp = 100, 2, 10
476
483
# number of good, number of bad, and number of samples
477
484
>>> s = dpnp.random.hypergeometric(ngood, nbad, nsamp, 1000)
@@ -595,6 +602,7 @@ def lognormal(mean=0.0, sigma=1.0, size=None):
595
602
Examples
596
603
--------
597
604
Draw samples from the distribution:
605
+
598
606
>>> mu, sigma = 3., 1. # mean and standard deviation
599
607
>>> s = dpnp.random.lognormal(mu, sigma, 1000)
600
608
@@ -647,6 +655,7 @@ def multinomial(n, pvals, size=None):
647
655
Examples
648
656
--------
649
657
Throw a dice 20 times:
658
+
650
659
>>> s = dpnp.random.multinomial(20, [1/6.]*6, size=1)
651
660
>>> s.shape
652
661
(1, 6)
@@ -816,6 +825,7 @@ def normal(
816
825
Examples
817
826
--------
818
827
Draw samples from the distribution:
828
+
819
829
>>> mu, sigma = 0, 0.1 # mean and standard deviation
820
830
>>> s = dpnp.random.normal(mu, sigma, 1000)
821
831
@@ -885,6 +895,7 @@ def pareto(a, size=None):
885
895
Examples
886
896
--------
887
897
Draw samples from the distribution:
898
+
888
899
>>> a = .5 # alpha
889
900
>>> s = dpnp.random.pareto(a, 1000)
890
901
@@ -953,6 +964,7 @@ def poisson(lam=1.0, size=None):
953
964
Examples
954
965
--------
955
966
Draw samples from the distribution:
967
+
956
968
>>> import numpy as np
957
969
>>> s = dpnp.random.poisson(5, 10000)
958
970
@@ -987,6 +999,7 @@ def power(a, size=None):
987
999
Examples
988
1000
--------
989
1001
Draw samples from the distribution:
1002
+
990
1003
>>> a = .5 # alpha
991
1004
>>> s = dpnp.random.power(a, 1000)
992
1005
@@ -1093,6 +1106,7 @@ def randint(
1093
1106
Examples
1094
1107
--------
1095
1108
Draw samples from the distribution:
1109
+
1096
1110
>>> low, high = 3, 11 # low and high
1097
1111
>>> s = dpnp.random.randint(low, high, 1000, dtype=dpnp.int32)
1098
1112
@@ -1364,6 +1378,7 @@ def rayleigh(scale=1.0, size=None):
1364
1378
Examples
1365
1379
--------
1366
1380
Draw samples from the distribution:
1381
+
1367
1382
>>> import numpy as np
1368
1383
>>> s = dpnp.random.rayleigh(1.0, 10000)
1369
1384
@@ -1514,6 +1529,7 @@ def standard_cauchy(size=None):
1514
1529
Examples
1515
1530
--------
1516
1531
Draw samples and plot the distribution:
1532
+
1517
1533
>>> import matplotlib.pyplot as plt
1518
1534
>>> s = dpnp.random.standard_cauchy(1000000)
1519
1535
>>> s = s[(s>-25) & (s<25)] # truncate distribution so it plots well
@@ -1542,6 +1558,7 @@ def standard_exponential(size=None):
1542
1558
Examples
1543
1559
--------
1544
1560
Output a 3x8000 array:
1561
+
1545
1562
>>> n = dpnp.random.standard_exponential((3, 8000))
1546
1563
1547
1564
"""
@@ -1568,6 +1585,7 @@ def standard_gamma(shape, size=None):
1568
1585
Examples
1569
1586
--------
1570
1587
Draw samples from the distribution:
1588
+
1571
1589
>>> shape = 2.
1572
1590
>>> s = dpnp.random.standard_gamma(shape, 1000000)
1573
1591
@@ -1615,6 +1633,7 @@ def standard_normal(size=None, device=None, usm_type="device", sycl_queue=None):
1615
1633
Examples
1616
1634
--------
1617
1635
Draw samples from the distribution:
1636
+
1618
1637
>>> s = dpnp.random.standard_normal(1000)
1619
1638
1620
1639
"""
@@ -1640,6 +1659,7 @@ def standard_t(df, size=None):
1640
1659
Examples
1641
1660
--------
1642
1661
Draw samples from the distribution:
1662
+
1643
1663
>>> df = 2.
1644
1664
>>> s = dpnp.random.standard_t(df, 1000000)
1645
1665
@@ -1675,6 +1695,7 @@ def triangular(left, mode, right, size=None):
1675
1695
Examples
1676
1696
--------
1677
1697
Draw samples from the distribution:
1698
+
1678
1699
>>> df = 2.
1679
1700
>>> s = dpnp.random.triangular(-3, 0, 8, 1000000)
1680
1701
@@ -1746,6 +1767,7 @@ def uniform(
1746
1767
Examples
1747
1768
--------
1748
1769
Draw samples from the distribution:
1770
+
1749
1771
>>> low, high = 0, 0.1 # low and high
1750
1772
>>> s = dpnp.random.uniform(low, high, 10000)
1751
1773
@@ -1763,8 +1785,6 @@ def uniform(
1763
1785
1764
1786
def vonmises (mu , kappa , size = None ):
1765
1787
"""
1766
- Von Mises distribution.
1767
-
1768
1788
Draw samples from a von Mises distribution.
1769
1789
1770
1790
For full documentation refer to :obj:`numpy.random.vonmises`.
@@ -1779,6 +1799,7 @@ def vonmises(mu, kappa, size=None):
1779
1799
Examples
1780
1800
--------
1781
1801
Draw samples from the distribution:
1802
+
1782
1803
>>> mu, kappa = 0.0, 4.0 # mean and dispersion
1783
1804
>>> s = dpnp.random.vonmises(mu, kappa, 1000)
1784
1805
0 commit comments