This file is indexed.

/usr/share/doc/libghc-random-fu-doc/html/random-fu.txt is in libghc-random-fu-doc 0.2.7.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Random number generation
--   
--   Random number generation based on modeling random variables in two
--   complementary ways: first, by the parameters of standard mathematical
--   distributions and, second, by an abstract type (<a>RVar</a>) which can
--   be composed and manipulated monadically and sampled in either monadic
--   or "pure" styles.
--   
--   The primary purpose of this library is to support defining and
--   sampling a wide variety of high quality random variables. Quality is
--   prioritized over speed, but performance is an important goal too.
--   
--   In my testing, I have found it capable of speed comparable to other
--   Haskell libraries, but still a fair bit slower than straight C
--   implementations of the same algorithms.
@package random-fu
@version 0.2.7.0

module Data.Random.Internal.Find
findMax :: (Fractional a, Ord a) => (a -> Bool) -> a

-- | Given an upward-closed predicate on an ordered Fractional type, find
--   the smallest value satisfying the predicate.
findMin :: (Fractional a, Ord a) => (a -> Bool) -> a

-- | Given an upward-closed predicate on an ordered Fractional type, find
--   the smallest value satisfying the predicate. Starts at the specified
--   point with the specified stepsize, performs an exponential search out
--   from there until it finds an interval bracketing the change-point of
--   the predicate, and then performs a bisection search to isolate the
--   change point. Note that infinitely-divisible domains such as
--   <a>Rational</a> cannot be searched by this function because it does
--   not terminate until it reaches a point where further subdivision of
--   the interval has no effect.
findMinFrom :: (Fractional a, Ord a) => a -> a -> (a -> Bool) -> a

module Data.Random.Internal.Fixed
resolutionOf :: HasResolution r => f r -> Integer
resolutionOf2 :: HasResolution r => f (g r) -> Integer

-- | The <a>Fixed</a> type doesn't expose its constructors, but I need a
--   way to convert them to and from their raw representation in order to
--   sample them. As long as <a>Fixed</a> is a newtype wrapping
--   <a>Integer</a>, <a>mkFixed</a> and <a>unMkFixed</a> as defined here
--   will work. Both are implemented using <a>unsafeCoerce</a>.
mkFixed :: Integer -> Fixed r
unMkFixed :: Fixed r -> Integer


-- | Template Haskell utility code to replicate instance declarations to
--   cover large numbers of types. I'm doing that rather than using class
--   contexts because most Distribution instances need to cover multiple
--   classes (such as Enum, Integral and Fractional) and that can't be done
--   easily because of overlap.
--   
--   I experimented a bit with a convoluted type-level classification
--   scheme, but I think this is simpler and easier to understand. It makes
--   the haddock docs more cluttered because of the combinatorial explosion
--   of instances, but overall I think it's just more sane than anything
--   else I've come up with yet.
module Data.Random.Internal.TH

-- | <tt>replicateInstances standin types decls</tt> will take the
--   template-haskell <a>Dec</a>s in <tt>decls</tt> and substitute every
--   instance of the <a>Name</a> <tt>standin</tt> with each <a>Name</a> in
--   <tt>types</tt>, producing one copy of the <a>Dec</a>s in
--   <tt>decls</tt> for every <a>Name</a> in <tt>types</tt>.
--   
--   For example, <a>Uniform</a> has the following bit of TH code:
--   
--   <pre>
--   $( replicateInstances ''Int integralTypes [d|
--   </pre>
--   
--   <pre>
--   instance Distribution Uniform Int   where rvar (Uniform a b) = integralUniform a b
--   </pre>
--   
--   <pre>
--   instance CDF Uniform Int            where cdf  (Uniform a b) = integralUniformCDF a b
--   </pre>
--   
--   <pre>
--   |])
--   </pre>
--   
--   This code takes those 2 instance declarations and creates identical
--   ones for every type named in <a>integralTypes</a>.
replicateInstances :: (Monad m, Data t) => Name -> [Name] -> m [t] -> m [t]

-- | Names of standard <a>Integral</a> types
integralTypes :: [Name]

-- | Names of standard <a>RealFloat</a> types
realFloatTypes :: [Name]

module Data.Random.Lift

-- | A class for "liftable" data structures. Conceptually an extension of
--   <a>MonadTrans</a> to allow deep lifting, but lifting need not be done
--   between monads only. Eg lifting between <a>Applicative</a>s is
--   allowed.
--   
--   For instances where <tt>m</tt> and <tt>n</tt> have 'return'/'pure'
--   defined, these instances must satisfy <tt>lift (return x) == return
--   x</tt>.
--   
--   This form of <a>lift</a> has an extremely general type and is used
--   primarily to support <tt>sample</tt>. Its excessive generality is the
--   main reason it's not exported from <a>Data.Random</a>. <a>RVarT</a>
--   is, however, an instance of <a>MonadTrans</a>, which in most cases is
--   the preferred way to do the lifting.
class Lift m n
lift :: Lift m n => m a -> n a

-- | This instance is incoherent with the others. However, by the law
--   <tt>lift (return x) == return x</tt>, the results must always be the
--   same.

-- | This instance is again incoherent with the others, but provides a
--   more-specific instance to resolve the overlap between the <tt>Lift m
--   (t m)</tt> and <tt>Lift Identity m</tt> instances.
instance (GHC.Base.Monad m, Control.Monad.Trans.Class.MonadTrans t) => Data.Random.Lift.Lift m (t m)
instance Data.Random.Lift.Lift m m
instance GHC.Base.Monad m => Data.Random.Lift.Lift Data.Functor.Identity.Identity m
instance Data.Random.Lift.Lift (Data.RVar.RVarT Data.Functor.Identity.Identity) (Data.RVar.RVarT m)
instance Control.Monad.Trans.Class.MonadTrans t => Data.Random.Lift.Lift Data.Functor.Identity.Identity (t Data.Functor.Identity.Identity)

module Data.Random.RVar

-- | An opaque type modeling a "random variable" - a value which depends on
--   the outcome of some random event. <a>RVar</a>s can be conveniently
--   defined by an imperative-looking style:
--   
--   <pre>
--   normalPair =  do
--       u &lt;- stdUniform
--       t &lt;- stdUniform
--       let r = sqrt (-2 * log u)
--           theta = (2 * pi) * t
--           
--           x = r * cos theta
--           y = r * sin theta
--       return (x,y)
--   </pre>
--   
--   OR by a more applicative style:
--   
--   <pre>
--   logNormal = exp &lt;$&gt; stdNormal
--   </pre>
--   
--   Once defined (in any style), there are several ways to sample
--   <a>RVar</a>s:
--   
--   <ul>
--   <li>In a monad, using a <a>RandomSource</a>:</li>
--   </ul>
--   
--   <pre>
--   runRVar (uniform 1 100) DevRandom :: IO Int
--   </pre>
--   
--   <ul>
--   <li>In a monad, using a <a>MonadRandom</a> instance:</li>
--   </ul>
--   
--   <pre>
--   sampleRVar (uniform 1 100) :: State PureMT Int
--   </pre>
--   
--   <ul>
--   <li>As a pure function transforming a functional RNG:</li>
--   </ul>
--   
--   <pre>
--   sampleState (uniform 1 100) :: StdGen -&gt; (Int, StdGen)
--   </pre>
--   
--   (where <tt>sampleState = runState . sampleRVar</tt>)
type RVar = RVarT Identity

-- | "Run" an <a>RVar</a> - samples the random variable from the provided
--   source of entropy.
runRVar :: RandomSource m s => RVar a -> s -> m a

-- | A random variable with access to operations in an underlying monad.
--   Useful examples include any form of state for implementing random
--   processes with hysteresis, or writer monads for implementing tracing
--   of complicated algorithms.
--   
--   For example, a simple random walk can be implemented as an
--   <a>RVarT</a> <a>IO</a> value:
--   
--   <pre>
--   rwalkIO :: IO (RVarT IO Double)
--   rwalkIO d = do
--       lastVal &lt;- newIORef 0
--       
--       let x = do
--               prev    &lt;- lift (readIORef lastVal)
--               change  &lt;- rvarT StdNormal
--               
--               let new = prev + change
--               lift (writeIORef lastVal new)
--               return new
--           
--       return x
--   </pre>
--   
--   To run the random walk it must first be initialized, after which it
--   can be sampled as usual:
--   
--   <pre>
--   do
--       rw &lt;- rwalkIO
--       x &lt;- sampleRVarT rw
--       y &lt;- sampleRVarT rw
--       ...
--   </pre>
--   
--   The same random-walk process as above can be implemented using MTL
--   types as follows (using <tt>import Control.Monad.Trans as MTL</tt>):
--   
--   <pre>
--   rwalkState :: RVarT (State Double) Double
--   rwalkState = do
--       prev &lt;- MTL.lift get
--       change  &lt;- rvarT StdNormal
--       
--       let new = prev + change
--       MTL.lift (put new)
--       return new
--   </pre>
--   
--   Invocation is straightforward (although a bit noisy) if you're used to
--   MTL:
--   
--   <pre>
--   rwalk :: Int -&gt; Double -&gt; StdGen -&gt; ([Double], StdGen)
--   rwalk count start gen = 
--       flip evalState start .
--           flip runStateT gen .
--               sampleRVarTWith MTL.lift $
--                   replicateM count rwalkState
--   </pre>
data RVarT (m :: * -> *) a :: (* -> *) -> * -> *

-- | Like <a>runRVarTWith</a>, but using an implicit lifting (provided by
--   the <a>Lift</a> class)
runRVarT :: (Lift n m, RandomSource m s) => RVarT n a -> s -> m a

-- | "Runs" an <a>RVarT</a>, sampling the random variable it defines.
--   
--   The first argument lifts the base monad into the sampling monad. This
--   operation must obey the "monad transformer" laws:
--   
--   <pre>
--   lift . return = return
--   lift (x &gt;&gt;= f) = (lift x) &gt;&gt;= (lift . f)
--   </pre>
--   
--   One example of a useful non-standard lifting would be one that takes
--   <tt>State s</tt> to another monad with a different state
--   representation (such as <tt>IO</tt> with the state mapped to an
--   <tt>IORef</tt>):
--   
--   <pre>
--   embedState :: (Monad m) =&gt; m s -&gt; (s -&gt; m ()) -&gt; State s a -&gt; m a
--   embedState get put = \m -&gt; do
--       s &lt;- get
--       (res,s) &lt;- return (runState m s)
--       put s
--       return res
--   </pre>
--   
--   The ability to lift is very important - without it, every <a>RVar</a>
--   would have to either be given access to the full capability of the
--   monad in which it will eventually be sampled (which, incidentally,
--   would also have to be monomorphic so you couldn't sample one
--   <a>RVar</a> in more than one monad) or functions manipulating
--   <a>RVar</a>s would have to use higher-ranked types to enforce the same
--   kind of isolation and polymorphism.
runRVarTWith :: RandomSource m s => (forall t. n t -> m t) -> RVarT n a -> s -> m a

module Data.Random.Distribution

-- | A <a>Distribution</a> is a data representation of a random variable's
--   probability structure. For example, in
--   <a>Data.Random.Distribution.Normal</a>, the <tt>Normal</tt>
--   distribution is defined as:
--   
--   <pre>
--   data Normal a
--       = StdNormal
--       | Normal a a
--   </pre>
--   
--   Where the two parameters of the <tt>Normal</tt> data constructor are
--   the mean and standard deviation of the random variable, respectively.
--   To make use of the <tt>Normal</tt> type, one can convert it to an
--   <a>rvar</a> and manipulate it or sample it directly:
--   
--   <pre>
--   x &lt;- sample (rvar (Normal 10 2))
--   x &lt;- sample (Normal 10 2)
--   </pre>
--   
--   A <a>Distribution</a> is typically more transparent than an
--   <a>RVar</a> but less composable (precisely because of that
--   transparency). There are several practical uses for types implementing
--   <a>Distribution</a>:
--   
--   <ul>
--   <li>Typically, a <a>Distribution</a> will expose several parameters of
--   a standard mathematical model of a probability distribution, such as
--   mean and std deviation for the normal distribution. Thus, they can be
--   manipulated analytically using mathematical insights about the
--   distributions they represent. For example, a collection of bernoulli
--   variables could be simplified into a (hopefully) smaller collection of
--   binomial variables.</li>
--   <li>Because they are generally just containers for parameters, they
--   can be easily serialized to persistent storage or read from
--   user-supplied configurations (eg, initialization data for a
--   simulation).</li>
--   <li>If a type additionally implements the <a>CDF</a> subclass, which
--   extends <a>Distribution</a> with a cumulative density function, an
--   arbitrary random variable <tt>x</tt> can be tested against the
--   distribution by testing <tt>fmap (cdf dist) x</tt> for
--   uniformity.</li>
--   </ul>
--   
--   On the other hand, most <a>Distribution</a>s will not be closed under
--   all the same operations as <a>RVar</a> (which, being a monad, has a
--   fully turing-complete internal computational model). The sum of two
--   uniformly-distributed variables, for example, is not uniformly
--   distributed. To support general composition, the <a>Distribution</a>
--   class defines a function <a>rvar</a> to construct the more-abstract
--   and more-composable <a>RVar</a> representation of a random variable.
class Distribution d t where rvar = rvarT rvarT d = lift (rvar d)

-- | Return a random variable with this distribution.
rvar :: Distribution d t => d t -> RVar t

-- | Return a random variable with the given distribution, pre-lifted to an
--   arbitrary <a>RVarT</a>. Any arbitrary <a>RVar</a> can also be
--   converted to an 'RVarT m' for an arbitrary <tt>m</tt>, using either
--   <a>lift</a> or <tt>sample</tt>.
rvarT :: Distribution d t => d t -> RVarT n t
class Distribution d t => PDF d t where pdf d = exp . logPdf d logPdf d = log . pdf d
pdf :: PDF d t => d t -> t -> Double
logPdf :: PDF d t => d t -> t -> Double
class Distribution d t => CDF d t

-- | Return the cumulative distribution function of this distribution. That
--   is, a function taking <tt>x :: t</tt> to the probability that the next
--   sample will return a value less than or equal to x, according to some
--   order or partial order (not necessarily an obvious one).
--   
--   In the case where <tt>t</tt> is an instance of Ord, <a>cdf</a> should
--   correspond to the CDF with respect to that order.
--   
--   In other cases, <a>cdf</a> is only required to satisfy the following
--   law: <tt>fmap (cdf d) (rvar d)</tt> must be uniformly distributed over
--   (0,1). Inclusion of either endpoint is optional, though the preferred
--   range is (0,1].
--   
--   Note that this definition requires that <a>cdf</a> for a product type
--   should _not_ be a joint CDF as commonly defined, as that definition
--   violates both conditions. Instead, it should be a univariate CDF over
--   the product type. That is, it should represent the CDF with respect to
--   the lexicographic order of the product.
--   
--   The present specification is probably only really useful for testing
--   conformance of a variable to its target distribution, and I am open to
--   suggestions for more-useful specifications (especially with regard to
--   the interaction with product types).
cdf :: CDF d t => d t -> t -> Double

module Data.Random.Distribution.Uniform

-- | A definition of a uniform distribution over the type <tt>t</tt>. See
--   also <a>uniform</a>.
data Uniform t

-- | A uniform distribution defined by a lower and upper range bound. For
--   <a>Integral</a> and <a>Enum</a> types, the range is inclusive. For
--   <a>Fractional</a> types the range includes the lower bound but not the
--   upper.
Uniform :: !t -> !t -> Uniform t
uniform :: Distribution Uniform a => a -> a -> RVar a
uniformT :: Distribution Uniform a => a -> a -> RVarT m a

-- | A name for the "standard" uniform distribution over the type
--   <tt>t</tt>, if one exists. See also <a>stdUniform</a>.
--   
--   For <a>Integral</a> and <a>Enum</a> types that are also
--   <a>Bounded</a>, this is the uniform distribution over the full range
--   of the type. For un-<a>Bounded</a> <a>Integral</a> types this is not
--   defined. For <a>Fractional</a> types this is a random variable in the
--   range [0,1) (that is, 0 to 1 including 0 but not including 1).
data StdUniform t
StdUniform :: StdUniform t

-- | Get a "standard" uniformly distributed variable. For integral types,
--   this means uniformly distributed over the full range of the type
--   (there is no support for <a>Integer</a>). For fractional types, this
--   means uniformly distributed on the interval [0,1).
stdUniform :: (Distribution StdUniform a) => RVar a

-- | Get a "standard" uniformly distributed process. For integral types,
--   this means uniformly distributed over the full range of the type
--   (there is no support for <a>Integer</a>). For fractional types, this
--   means uniformly distributed on the interval [0,1).
stdUniformT :: (Distribution StdUniform a) => RVarT m a

-- | Like <a>stdUniform</a> but only returns positive values.
stdUniformPos :: (Distribution StdUniform a, Num a, Eq a) => RVar a

-- | Like <a>stdUniform</a> but only returns positive values.
stdUniformPosT :: (Distribution StdUniform a, Num a, Eq a) => RVarT m a

-- | Compute a random <a>Integral</a> value between the 2 values provided
--   (inclusive).
integralUniform :: (Integral a) => a -> a -> RVarT m a

-- | <tt>realFloatUniform a b</tt> computes a uniform random value in the
--   range [a,b) for any <a>RealFloat</a> type
realFloatUniform :: RealFloat a => a -> a -> RVarT m a

-- | <tt>floatUniform a b</tt> computes a uniform random <a>Float</a> value
--   in the range [a,b)
floatUniform :: Float -> Float -> RVarT m Float

-- | <tt>doubleUniform a b</tt> computes a uniform random <a>Double</a>
--   value in the range [a,b)
doubleUniform :: Double -> Double -> RVarT m Double

-- | <tt>fixedUniform a b</tt> computes a uniform random <a>Fixed</a> value
--   in the range [a,b), with any desired precision.
fixedUniform :: HasResolution r => Fixed r -> Fixed r -> RVarT m (Fixed r)

-- | <tt>realFloatUniform a b</tt> computes a uniform random value in the
--   range [a,b) for any <a>Enum</a> type
enumUniform :: Enum a => a -> a -> RVarT m a

-- | Compute a random value for a <a>Bounded</a> type, between
--   <a>minBound</a> and <a>maxBound</a> (inclusive for <a>Integral</a> or
--   <a>Enum</a> types, in [<a>minBound</a>, <a>maxBound</a>) for
--   Fractional types.)
boundedStdUniform :: (Distribution Uniform a, Bounded a) => RVar a

-- | Compute a random value for a <a>Bounded</a> <a>Enum</a> type, between
--   <a>minBound</a> and <a>maxBound</a> (inclusive)
boundedEnumStdUniform :: (Enum a, Bounded a) => RVarT m a

-- | Compute a uniform random value in the range [0,1) for any
--   <a>RealFloat</a> type
realFloatStdUniform :: RealFloat a => RVarT m a

-- | Compute a uniform random <a>Fixed</a> value in the range [0,1), with
--   any desired precision.
fixedStdUniform :: HasResolution r => RVarT m (Fixed r)

-- | Compute a uniform random <a>Float</a> value in the range [0,1)
floatStdUniform :: RVarT m Float

-- | Compute a uniform random <a>Double</a> value in the range [0,1)
doubleStdUniform :: RVarT m Double
boundedStdUniformCDF :: (CDF Uniform a, Bounded a) => a -> Double

-- | The CDF of the random variable <a>realFloatStdUniform</a>.
realStdUniformCDF :: Real a => a -> Double

-- | <tt>realUniformCDF a b</tt> is the CDF of the random variable
--   <tt>realFloatUniform a b</tt>.
realUniformCDF :: RealFrac a => a -> a -> a -> Double
enumUniformCDF :: (Enum a, Ord a) => a -> a -> a -> Double
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Char
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Char
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Bool
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Bool
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Ordering
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Ordering
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform ()
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform ()
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Bool
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Bool
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Char
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Char
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Ordering
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Ordering
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Integer.Type.Integer
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Integer.Type.Integer
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Int
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Int
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Int.Int8
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Int.Int8
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Int.Int16
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Int.Int16
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Int.Int32
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Int.Int32
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Int.Int64
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Int.Int64
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Word
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Word
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Word.Word8
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Word.Word8
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Word.Word16
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Word.Word16
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Word.Word32
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Word.Word32
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Word.Word64
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Word.Word64
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word8
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word16
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word32
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word64
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int8
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int16
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int32
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int64
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Int
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Word
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word8
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word16
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word32
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Word.Word64
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Word
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int8
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int16
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int32
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Int.Int64
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Int
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Float
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform GHC.Types.Double
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Float
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform GHC.Types.Double
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Float
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform GHC.Types.Double
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Float
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Double
instance Data.Random.Distribution.PDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Float
instance Data.Random.Distribution.PDF Data.Random.Distribution.Uniform.StdUniform GHC.Types.Double
instance Data.Fixed.HasResolution r => Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform (Data.Fixed.Fixed r)
instance Data.Fixed.HasResolution r => Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform (Data.Fixed.Fixed r)
instance Data.Fixed.HasResolution r => Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform (Data.Fixed.Fixed r)
instance Data.Fixed.HasResolution r => Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.StdUniform (Data.Fixed.Fixed r)
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform ()
instance Data.Random.Distribution.CDF Data.Random.Distribution.Uniform.Uniform ()

module Data.Random.List

-- | A random variable returning an arbitrary element of the given list.
--   Every element has equal probability of being chosen. Because it is a
--   pure <a>RVar</a> it has no memory - that is, it "draws with
--   replacement."
randomElement :: [a] -> RVar a
randomElementT :: [a] -> RVarT m a

-- | A random variable that returns the given list in an arbitrary shuffled
--   order. Every ordering of the list has equal probability.
shuffle :: [a] -> RVar [a]
shuffleT :: [a] -> RVarT m [a]

-- | A random variable that shuffles a list of a known length (or a list
--   prefix of the specified length). Useful for shuffling large lists when
--   the length is known in advance. Avoids needing to traverse the list to
--   discover its length. Each ordering has equal probability.
shuffleN :: Int -> [a] -> RVar [a]
shuffleNT :: Int -> [a] -> RVarT m [a]

-- | A random variable that selects N arbitrary elements of a list of known
--   length M.
shuffleNofM :: Int -> Int -> [a] -> RVar [a]
shuffleNofMT :: Int -> Int -> [a] -> RVarT m [a]

module Data.Random.Vector

-- | Take a random element of a vector.
randomElement :: Vector a -> RVar a

module Data.Random.Distribution.Bernoulli

-- | Generate a Bernoulli variate with the given probability. For
--   <tt>Bool</tt> results, <tt>bernoulli p</tt> will return True (p*100)%
--   of the time and False otherwise. For numerical types, True is replaced
--   by 1 and False by 0.
bernoulli :: Distribution (Bernoulli b) a => b -> RVar a

-- | Generate a Bernoulli process with the given probability. For
--   <tt>Bool</tt> results, <tt>bernoulli p</tt> will return True (p*100)%
--   of the time and False otherwise. For numerical types, True is replaced
--   by 1 and False by 0.
bernoulliT :: Distribution (Bernoulli b) a => b -> RVarT m a

-- | A random variable whose value is <a>True</a> the given fraction of the
--   time and <a>False</a> the rest.
boolBernoulli :: (Fractional a, Ord a, Distribution StdUniform a) => a -> RVarT m Bool
boolBernoulliCDF :: (Real a) => a -> Bool -> Double

-- | <tt>generalBernoulli t f p</tt> generates a random variable whose
--   value is <tt>t</tt> with probability <tt>p</tt> and <tt>f</tt> with
--   probability <tt>1-p</tt>.
generalBernoulli :: Distribution (Bernoulli b) Bool => a -> a -> b -> RVarT m a
generalBernoulliCDF :: CDF (Bernoulli b) Bool => (a -> a -> Bool) -> a -> a -> b -> a -> Double
newtype Bernoulli b a
Bernoulli :: b -> Bernoulli b a
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Float
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Float
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Double
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Double
instance (Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool, GHC.Real.Integral a) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) (GHC.Real.Ratio a)
instance (Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool, GHC.Real.Integral a) => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b) (GHC.Real.Ratio a)
instance (Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool, GHC.Float.RealFloat a) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) (Data.Complex.Complex a)
instance (Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool, GHC.Float.RealFloat a) => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b) (Data.Complex.Complex a)
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Integer.Type.Integer
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Integer.Type.Integer
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Int
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Int
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int8
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int8
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int16
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int16
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int32
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int32
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int64
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Int.Int64
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Word
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Word
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word8
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word8
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word16
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word16
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word32
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word32
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word64
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Types.Bool => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b0) GHC.Word.Word64
instance (GHC.Real.Fractional b, GHC.Classes.Ord b, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool
instance (Data.Random.Distribution.Distribution (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool, GHC.Real.Real b) => Data.Random.Distribution.CDF (Data.Random.Distribution.Bernoulli.Bernoulli b) GHC.Types.Bool

module Data.Random.Distribution.Categorical

-- | Categorical distribution; a list of events with corresponding
--   probabilities. The sum of the probabilities must be 1, and no event
--   should have a zero or negative probability (at least, at time of
--   sampling; very clever users can do what they want with the numbers
--   before sampling, just make sure that if you're one of those clever
--   ones, you at least eliminate negative weights before sampling).
data Categorical p a

-- | Construct a <a>Categorical</a> random variable from a list of
--   probabilities and categories, where the probabilities all sum to 1.
categorical :: (Num p, Distribution (Categorical p) a) => [(p, a)] -> RVar a

-- | Construct a <a>Categorical</a> random process from a list of
--   probabilities and categories, where the probabilities all sum to 1.
categoricalT :: (Num p, Distribution (Categorical p) a) => [(p, a)] -> RVarT m a

-- | Construct a <a>Categorical</a> random variable from a list of
--   probabilities and categories, where the probabilities all sum to 1.
weightedCategorical :: (Fractional p, Eq p, Distribution (Categorical p) a) => [(p, a)] -> RVar a

-- | Construct a <a>Categorical</a> random process from a list of
--   probabilities and categories, where the probabilities all sum to 1.
weightedCategoricalT :: (Fractional p, Eq p, Distribution (Categorical p) a) => [(p, a)] -> RVarT m a

-- | Construct a <a>Categorical</a> distribution from a list of weighted
--   categories.
fromList :: (Num p) => [(p, a)] -> Categorical p a
toList :: (Num p) => Categorical p a -> [(p, a)]
totalWeight :: Num p => Categorical p a -> p
numEvents :: Categorical p a -> Int

-- | Construct a <a>Categorical</a> distribution from a list of weighted
--   categories, where the weights do not necessarily sum to 1.
fromWeightedList :: (Fractional p, Eq p) => [(p, a)] -> Categorical p a

-- | Construct a <a>Categorical</a> distribution from a list of observed
--   outcomes. Equivalent events will be grouped and counted, and the
--   probabilities of each event in the returned distribution will be
--   proportional to the number of occurrences of that event.
fromObservations :: (Fractional p, Eq p, Ord a) => [a] -> Categorical p a

-- | Like <a>fmap</a>, but for the probabilities of a categorical
--   distribution.
mapCategoricalPs :: (Num p, Num q) => (p -> q) -> Categorical p e -> Categorical q e

-- | Adjust all the weights of a categorical distribution so that they sum
--   to unity and remove all events whose probability is zero.
normalizeCategoricalPs :: (Fractional p, Eq p) => Categorical p e -> Categorical p e

-- | Simplify a categorical distribution by combining equivalent events
--   (the new event will have a probability equal to the sum of all the
--   originals).
collectEvents :: (Ord e, Num p, Ord p) => Categorical p e -> Categorical p e

-- | Simplify a categorical distribution by combining equivalent events
--   (the new event will have a weight equal to the sum of all the
--   originals). The comparator function is used to identify events to
--   combine. Once chosen, the events and their weights are combined by the
--   provided probability and event aggregation function.
collectEventsBy :: Num p => (e -> e -> Ordering) -> ([(p, e)] -> (p, e)) -> Categorical p e -> Categorical p e
instance (GHC.Classes.Eq p, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Random.Distribution.Categorical.Categorical p a)
instance (GHC.Num.Num p, GHC.Show.Show p, GHC.Show.Show a) => GHC.Show.Show (Data.Random.Distribution.Categorical.Categorical p a)
instance (GHC.Num.Num p, GHC.Read.Read p, GHC.Read.Read a) => GHC.Read.Read (Data.Random.Distribution.Categorical.Categorical p a)
instance (GHC.Real.Fractional p, GHC.Classes.Ord p, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.Uniform p) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Categorical.Categorical p) a
instance GHC.Base.Functor (Data.Random.Distribution.Categorical.Categorical p)
instance Data.Foldable.Foldable (Data.Random.Distribution.Categorical.Categorical p)
instance Data.Traversable.Traversable (Data.Random.Distribution.Categorical.Categorical p)
instance GHC.Real.Fractional p => GHC.Base.Monad (Data.Random.Distribution.Categorical.Categorical p)
instance GHC.Real.Fractional p => GHC.Base.Applicative (Data.Random.Distribution.Categorical.Categorical p)

module Data.Random.Distribution.Exponential
newtype Exponential a
Exp :: a -> Exponential a
floatingExponential :: (Floating a, Distribution StdUniform a) => a -> RVarT m a
floatingExponentialCDF :: Real a => a -> a -> Double
exponential :: Distribution Exponential a => a -> RVar a
exponentialT :: Distribution Exponential a => a -> RVarT m a
instance (GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Exponential.Exponential a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Exponential.Exponential a) => Data.Random.Distribution.CDF Data.Random.Distribution.Exponential.Exponential a

module Data.Random.Distribution.StretchedExponential
newtype StretchedExponential a
StretchedExp :: (a, a) -> StretchedExponential a
floatingStretchedExponential :: (Floating a, Distribution StdUniform a) => a -> a -> RVarT m a
floatingStretchedExponentialCDF :: Real a => a -> a -> a -> Double
stretchedExponential :: Distribution StretchedExponential a => a -> a -> RVar a
stretchedExponentialT :: Distribution StretchedExponential a => a -> a -> RVarT m a
instance (GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.StretchedExponential.StretchedExponential a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.StretchedExponential.StretchedExponential a) => Data.Random.Distribution.CDF Data.Random.Distribution.StretchedExponential.StretchedExponential a


-- | A generic "ziggurat algorithm" implementation. Fairly rough right now.
--   
--   There is a lot of room for improvement in <a>findBin0</a> especially.
--   It needs a fair amount of cleanup and elimination of redundant
--   calculation, as well as either a justification for using the simple
--   <a>findMinFrom</a> or a proper root-finding algorithm.
--   
--   It would also be nice to add (preferably by pulling in an external
--   package) support for numerical integration and differentiation, so
--   that tables can be derived from only a PDF (if the end user is willing
--   to take the performance and accuracy hit for the convenience).
module Data.Random.Distribution.Ziggurat

-- | A data structure containing all the data that is needed to implement
--   Marsaglia &amp; Tang's "ziggurat" algorithm for sampling certain kinds
--   of random distributions.
--   
--   The documentation here is probably not sufficient to tell a user
--   exactly how to build one of these from scratch, but it is not really
--   intended to be. There are several helper functions that will build
--   <a>Ziggurat</a>s. The pathologically curious may wish to read the
--   <a>runZiggurat</a> source. That is the ultimate specification of the
--   semantics of all these fields.
data Ziggurat v t
Ziggurat :: !(v t) -> !(v t) -> !(v t) -> !(forall m. RVarT m (Int, t)) -> (forall m. RVarT m t) -> !(forall m. t -> t -> RVarT m t) -> !(t -> t) -> !Bool -> Ziggurat v t

-- | The X locations of each bin in the distribution. Bin 0 is the
--   <tt>infinite</tt> one.
--   
--   In the case of bin 0, the value given is sort of magical - x[0] is
--   defined to be V/f(R). It's not actually the location of any bin, but a
--   value computed to make the algorithm more concise and slightly faster
--   by not needing to specially-handle bin 0 quite as often. If you really
--   need to know why it works, see the <a>runZiggurat</a> source or "the
--   literature" - it's a fairly standard setup.
[zTable_xs] :: Ziggurat v t -> !(v t)

-- | The ratio of each bin's Y value to the next bin's Y value
[zTable_y_ratios] :: Ziggurat v t -> !(v t)

-- | The Y value (zFunc x) of each bin
[zTable_ys] :: Ziggurat v t -> !(v t)

-- | An RVar providing a random tuple consisting of:
--   
--   <ul>
--   <li>a bin index, uniform over [0,c) :: Int (where <tt>c</tt> is the
--   number of bins in the tables)</li>
--   <li>a uniformly distributed fractional value, from -1 to 1 if not
--   mirrored, from 0 to 1 otherwise.</li>
--   </ul>
--   
--   This is provided as a single <a>RVar</a> because it can be implemented
--   more efficiently than naively sampling 2 separate values - a single
--   random word (64 bits) can be efficiently converted to a double (using
--   52 bits) and a bin number (using up to 12 bits), for example.
[zGetIU] :: Ziggurat v t -> !(forall m. RVarT m (Int, t))

-- | The distribution for the final "virtual" bin (the ziggurat algorithm
--   does not handle distributions that wander off to infinity, so another
--   distribution is needed to handle the last "bin" that stretches to
--   infinity)
[zTailDist] :: Ziggurat v t -> (forall m. RVarT m t)

-- | A copy of the uniform RVar generator for the base type, so that
--   <tt>Distribution Uniform t</tt> is not needed when sampling from a
--   Ziggurat (makes it a bit more self-contained).
[zUniform] :: Ziggurat v t -> !(forall m. t -> t -> RVarT m t)

-- | The (one-sided antitone) PDF, not necessarily normalized
[zFunc] :: Ziggurat v t -> !(t -> t)

-- | A flag indicating whether the distribution should be mirrored about
--   the origin (the ziggurat algorithm in its native form only samples
--   from one-sided distributions. By mirroring, we can extend it to
--   symmetric distributions such as the normal distribution)
[zMirror] :: Ziggurat v t -> !Bool

-- | Build a lazy recursive ziggurat. Uses a lazily-constructed ziggurat as
--   its tail distribution (with another as its tail, ad nauseam).
--   
--   Arguments:
--   
--   <ul>
--   <li>flag indicating whether to mirror the distribution</li>
--   <li>the (one-sided antitone) PDF, not necessarily normalized</li>
--   <li>the inverse of the PDF</li>
--   <li>the integral of the PDF (definite, from 0)</li>
--   <li>the estimated volume under the PDF (from 0 to +infinity)</li>
--   <li>the chunk size (number of bins in each layer). 64 seems to perform
--   well in practice.</li>
--   <li>an RVar providing the <a>zGetIU</a> random tuple</li>
--   </ul>
mkZigguratRec :: (RealFloat t, Vector v t, Distribution Uniform t) => Bool -> (t -> t) -> (t -> t) -> (t -> t) -> t -> Int -> (forall m. RVarT m (Int, t)) -> Ziggurat v t

-- | Build the tables to implement the "ziggurat algorithm" devised by
--   Marsaglia &amp; Tang, attempting to automatically compute the R and V
--   values.
--   
--   Arguments are the same as for <a>mkZigguratRec</a>, with an additional
--   argument for the tail distribution as a function of the selected R
--   value.
mkZiggurat :: (RealFloat t, Vector v t, Distribution Uniform t) => Bool -> (t -> t) -> (t -> t) -> (t -> t) -> t -> Int -> (forall m. RVarT m (Int, t)) -> (forall m. t -> RVarT m t) -> Ziggurat v t

-- | Build the tables to implement the "ziggurat algorithm" devised by
--   Marsaglia &amp; Tang, attempting to automatically compute the R and V
--   values.
--   
--   Arguments:
--   
--   <ul>
--   <li>flag indicating whether to mirror the distribution</li>
--   <li>the (one-sided antitone) PDF, not necessarily normalized</li>
--   <li>the inverse of the PDF</li>
--   <li>the number of bins</li>
--   <li>R, the x value of the first bin</li>
--   <li>V, the volume of each bin</li>
--   <li>an RVar providing the <a>zGetIU</a> random tuple</li>
--   <li>an RVar sampling from the tail (the region where x &gt; R)</li>
--   </ul>
mkZiggurat_ :: (RealFloat t, Vector v t, Distribution Uniform t) => Bool -> (t -> t) -> (t -> t) -> Int -> t -> t -> (forall m. RVarT m (Int, t)) -> (forall m. RVarT m t) -> Ziggurat v t

-- | I suspect this isn't completely right, but it works well so far.
--   Search the distribution for an appropriate R and V.
--   
--   Arguments:
--   
--   <ul>
--   <li>Number of bins</li>
--   <li>target function (one-sided antitone PDF, not necessarily
--   normalized)</li>
--   <li>function inverse</li>
--   <li>function definite integral (from 0 to _)</li>
--   <li>estimate of total volume under function (integral from 0 to
--   infinity)</li>
--   </ul>
--   
--   Result: (R,V)
findBin0 :: (RealFloat b) => Int -> (b -> b) -> (b -> b) -> (b -> b) -> b -> (b, b)

-- | Sample from the distribution encoded in a <a>Ziggurat</a> data
--   structure.
runZiggurat :: (Num a, Ord a, Vector v a) => Ziggurat v a -> RVarT m a
instance (GHC.Num.Num t, GHC.Classes.Ord t, Data.Vector.Generic.Base.Vector v t) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Ziggurat.Ziggurat v) t

module Data.Random.Distribution.Normal

-- | A specification of a normal distribution over the type <tt>a</tt>.
data Normal a

-- | The "standard" normal distribution - mean 0, stddev 1
StdNormal :: Normal a

-- | <tt>Normal m s</tt> is a normal distribution with mean <tt>m</tt> and
--   stddev <tt>sd</tt>.
Normal :: a -> a -> Normal a

-- | <tt>normal m s</tt> is a random variable with distribution
--   <tt><a>Normal</a> m s</tt>.
normal :: Distribution Normal a => a -> a -> RVar a

-- | <tt>normalT m s</tt> is a random process with distribution
--   <tt><a>Normal</a> m s</tt>.
normalT :: Distribution Normal a => a -> a -> RVarT m a

-- | <a>stdNormal</a> is a normal variable with distribution
--   <a>StdNormal</a>.
stdNormal :: Distribution Normal a => RVar a

-- | <a>stdNormalT</a> is a normal process with distribution
--   <a>StdNormal</a>.
stdNormalT :: Distribution Normal a => RVarT m a

-- | A random variable sampling from the standard normal distribution over
--   the <a>Double</a> type.
doubleStdNormal :: RVarT m Double

-- | A random variable sampling from the standard normal distribution over
--   the <a>Float</a> type.
floatStdNormal :: RVarT m Float

-- | A random variable sampling from the standard normal distribution over
--   any <a>RealFloat</a> type (subject to the rest of the constraints - it
--   builds and uses a <a>Ziggurat</a> internally, which requires the
--   <a>Erf</a> class).
--   
--   Because it computes a <a>Ziggurat</a>, it is very expensive to use for
--   just one evaluation, or even for multiple evaluations if not used and
--   reused monomorphically (to enable the ziggurat table to be let-floated
--   out). If you don't know whether your use case fits this description
--   then you're probably better off using a different algorithm, such as
--   <a>boxMullerNormalPair</a> or <a>knuthPolarNormalPair</a>. And of
--   course if you don't need the full generality of this definition then
--   you're much better off using <a>doubleStdNormal</a> or
--   <a>floatStdNormal</a>.
--   
--   As far as I know, this should be safe to use in any monomorphic
--   <tt>Distribution Normal</tt> instance declaration.
realFloatStdNormal :: (RealFloat a, Erf a, Distribution Uniform a) => RVarT m a

-- | Draw from the tail of a normal distribution (the region beyond the
--   provided value)
normalTail :: (Distribution StdUniform a, Floating a, Ord a) => a -> RVarT m a

-- | A random variable that produces a pair of independent
--   normally-distributed values.
normalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a)

-- | A random variable that produces a pair of independent
--   normally-distributed values, computed using the Box-Muller method.
--   This algorithm is slightly slower than Knuth's method but using a
--   constant amount of entropy (Knuth's method is a rejection method). It
--   is also slightly more general (Knuth's method require an <a>Ord</a>
--   instance).
boxMullerNormalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a)

-- | A random variable that produces a pair of independent
--   normally-distributed values, computed using Knuth's polar method.
--   Slightly faster than <a>boxMullerNormalPair</a> when it accepts on the
--   first try, but does not always do so.
knuthPolarNormalPair :: (Floating a, Ord a, Distribution Uniform a) => RVar (a, a)
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal GHC.Types.Double
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal GHC.Types.Float
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal a) => Data.Random.Distribution.CDF Data.Random.Distribution.Normal.Normal a
instance (GHC.Real.Real a, GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal a) => Data.Random.Distribution.PDF Data.Random.Distribution.Normal.Normal a

module Data.Random.Distribution.Gamma
data Gamma a
Gamma :: a -> a -> Gamma a
gamma :: (Distribution Gamma a) => a -> a -> RVar a
gammaT :: (Distribution Gamma a) => a -> a -> RVarT m a
newtype Erlang a b
Erlang :: a -> Erlang a b
erlang :: (Distribution (Erlang a) b) => a -> RVar b
erlangT :: (Distribution (Erlang a) b) => a -> RVarT m b

-- | derived from Marsaglia &amp; Tang, "A Simple Method for generating
--   gamma variables", ACM Transactions on Mathematical Software, Vol 26,
--   No 3 (2000), p363-372.
mtGamma :: (Floating a, Ord a, Distribution StdUniform a, Distribution Normal a) => a -> a -> RVarT m a
instance (GHC.Float.Floating a, GHC.Classes.Ord a, Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Gamma.Gamma a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Gamma.Gamma a) => Data.Random.Distribution.CDF Data.Random.Distribution.Gamma.Gamma a
instance (GHC.Real.Integral a, GHC.Float.Floating b, GHC.Classes.Ord b, Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal b, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang a) b
instance (GHC.Real.Integral a, GHC.Real.Real b, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang a) b) => Data.Random.Distribution.CDF (Data.Random.Distribution.Gamma.Erlang a) b

module Data.Random.Distribution.Beta
fractionalBeta :: (Fractional a, Eq a, Distribution Gamma a, Distribution StdUniform a) => a -> a -> RVarT m a
beta :: Distribution Beta a => a -> a -> RVar a
betaT :: Distribution Beta a => a -> a -> RVarT m a
data Beta a
Beta :: a -> a -> Beta a
logBetaPdf :: Double -> Double -> Double -> Double
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta GHC.Types.Float
instance Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta GHC.Types.Double
instance Data.Random.Distribution.PDF Data.Random.Distribution.Beta.Beta GHC.Types.Double
instance Data.Random.Distribution.PDF Data.Random.Distribution.Beta.Beta GHC.Types.Float

module Data.Random.Distribution.Binomial
integralBinomial :: (Integral a, Floating b, Ord b, Distribution Beta b, Distribution StdUniform b) => a -> b -> RVarT m a
integralBinomialCDF :: (Integral a, Real b) => a -> b -> a -> Double

-- | The probability of getting exactly k successes in n trials is given by
--   the probability mass function:
--   
--   &lt;math&gt;
--   
--   Note that in <a>integralBinomialPDF</a> the parameters of the mass
--   function are given first and the range of the random variable
--   distributed according to the binomial distribution is given last. That
--   is, &lt;math&gt; is calculated by <tt>integralBinomialPDF 4 0.5
--   2</tt>.
integralBinomialPDF :: (Integral a, Real b) => a -> b -> a -> Double

-- | We use the method given in "Fast and accurate computation of binomial
--   probabilities, Loader, C",
--   <a>http://octave.1599824.n4.nabble.com/attachment/3829107/0/loader2000Fast.pdf</a>
integralBinomialLogPdf :: (Integral a, Real b) => a -> b -> a -> Double
floatingBinomial :: (RealFrac a, Distribution (Binomial b) Integer) => a -> b -> RVar a
floatingBinomialCDF :: (CDF (Binomial b) Integer, RealFrac a) => a -> b -> a -> Double
floatingBinomialPDF :: (PDF (Binomial b) Integer, RealFrac a) => a -> b -> a -> Double
floatingBinomialLogPDF :: (PDF (Binomial b) Integer, RealFrac a) => a -> b -> a -> Double
binomial :: Distribution (Binomial b) a => a -> b -> RVar a
binomialT :: Distribution (Binomial b) a => a -> b -> RVarT m a
data Binomial b a
Binomial :: a -> b -> Binomial b a
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Float
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Float
instance Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Float
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Double
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Double
instance Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Double
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32
instance (GHC.Float.Floating b0, GHC.Classes.Ord b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Beta.Beta b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64) => Data.Random.Distribution.CDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64) => Data.Random.Distribution.PDF (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64

module Data.Random.Distribution.Multinomial
multinomial :: Distribution (Multinomial p) [a] => [p] -> a -> RVar [a]
multinomialT :: Distribution (Multinomial p) [a] => [p] -> a -> RVarT m [a]
data Multinomial p a
[Multinomial] :: [p] -> a -> Multinomial p [a]
instance (GHC.Num.Num a, GHC.Classes.Eq a, GHC.Real.Fractional p, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial p) a) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Multinomial.Multinomial p) [a]

module Data.Random.Distribution.ChiSquare
chiSquare :: Distribution ChiSquare t => Integer -> RVar t
chiSquareT :: Distribution ChiSquare t => Integer -> RVarT m t
newtype ChiSquare b
ChiSquare :: Integer -> ChiSquare b
instance (GHC.Real.Fractional t, Data.Random.Distribution.Distribution Data.Random.Distribution.Gamma.Gamma t) => Data.Random.Distribution.Distribution Data.Random.Distribution.ChiSquare.ChiSquare t
instance (GHC.Real.Real t, Data.Random.Distribution.Distribution Data.Random.Distribution.ChiSquare.ChiSquare t) => Data.Random.Distribution.CDF Data.Random.Distribution.ChiSquare.ChiSquare t

module Data.Random.Distribution.Dirichlet
fractionalDirichlet :: (Fractional a, Distribution Gamma a) => [a] -> RVarT m [a]
dirichlet :: Distribution Dirichlet [a] => [a] -> RVar [a]
dirichletT :: Distribution Dirichlet [a] => [a] -> RVarT m [a]
newtype Dirichlet a
Dirichlet :: a -> Dirichlet a
instance GHC.Show.Show a => GHC.Show.Show (Data.Random.Distribution.Dirichlet.Dirichlet a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Random.Distribution.Dirichlet.Dirichlet a)
instance (GHC.Real.Fractional a, Data.Random.Distribution.Distribution Data.Random.Distribution.Gamma.Gamma a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Dirichlet.Dirichlet [a]

module Data.Random.Distribution.Poisson
integralPoisson :: (Integral a, RealFloat b, Distribution StdUniform b, Distribution (Erlang a) b, Distribution (Binomial b) a) => b -> RVarT m a
integralPoissonCDF :: (Integral a, Real b) => b -> a -> Double
fractionalPoisson :: (Num a, Distribution (Poisson b) Integer) => b -> RVarT m a
fractionalPoissonCDF :: (CDF (Poisson b) Integer, RealFrac a) => b -> a -> Double
poisson :: (Distribution (Poisson b) a) => b -> RVar a
poissonT :: (Distribution (Poisson b) a) => b -> RVarT m a
newtype Poisson b a
Poisson :: b -> Poisson b a
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Float
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Float
instance Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Double
instance Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Double
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Integer.Type.Integer) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Integer.Type.Integer) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Integer.Type.Integer
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Types.Int) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Int) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Int
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Int) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Int
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Int.Int8) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int8) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int8) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int8
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Int.Int16) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int16) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int16) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int16
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Int.Int32) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int32) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int32) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int32
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Int.Int64) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Int.Int64) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int64) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Int.Int64
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Types.Word) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Types.Word) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Word
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Word) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Types.Word
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Word.Word8) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word8) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word8
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word8) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word8
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Word.Word16) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word16) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word16
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word16) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word16
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Word.Word32) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word32) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word32
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word32) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word32
instance (GHC.Float.RealFloat b0, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Gamma.Erlang GHC.Word.Word64) b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Binomial.Binomial b0) GHC.Word.Word64) => Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word64
instance (GHC.Real.Real b0, Data.Random.Distribution.Distribution (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word64) => Data.Random.Distribution.CDF (Data.Random.Distribution.Poisson.Poisson b0) GHC.Word.Word64

module Data.Random.Distribution.Rayleigh
floatingRayleigh :: (Floating a, Eq a, Distribution StdUniform a) => a -> RVarT m a

-- | The rayleigh distribution with a specified mode ("sigma") parameter.
--   Its mean will be <tt>sigma*sqrt(pi/2)</tt> and its variance will be
--   <tt>sigma^2*(4-pi)/2</tt>
--   
--   (therefore if you want one with a particular mean <tt>m</tt>,
--   <tt>sigma</tt> should be <tt>m*sqrt(2/pi)</tt>)
newtype Rayleigh a
Rayleigh :: a -> Rayleigh a
rayleigh :: Distribution Rayleigh a => a -> RVar a
rayleighT :: Distribution Rayleigh a => a -> RVarT m a
rayleighCDF :: Real a => a -> a -> Double
instance (GHC.Float.RealFloat a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Rayleigh.Rayleigh a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Rayleigh.Rayleigh a) => Data.Random.Distribution.CDF Data.Random.Distribution.Rayleigh.Rayleigh a

module Data.Random.Distribution.Simplex

-- | Uniform distribution over a standard simplex.
newtype StdSimplex as

-- | <tt>StdSimplex k</tt> constructs a standard simplex of dimension
--   <tt>k</tt> (standard <i>k</i>-simplex). An element of the simplex
--   represents a vector variable <tt>as = (a_0, a_1, ..., a_k)</tt>. The
--   elements of <tt>as</tt> are more than or equal to <tt>0</tt> and
--   <tt>sum as</tt> is always equal to <tt>1</tt>.
StdSimplex :: Int -> StdSimplex as

-- | <tt>stdSimplex k</tt> returns a random variable being uniformly
--   distributed over a standard simplex of dimension <tt>k</tt>.
stdSimplex :: Distribution StdSimplex [a] => Int -> RVar [a]
stdSimplexT :: Distribution StdSimplex [a] => Int -> RVarT m [a]

-- | An algorithm proposed by Rubinstein &amp; Melamed (1998). See,
--   <i>e.g.</i>, S. Onn, I. Weissman. Generating uniform random vectors
--   over a simplex with implications to the volume of a certain polytope
--   and to multivariate extremes. <i>Ann Oper Res</i> (2011)
--   <b>189</b>:331-342.
fractionalStdSimplex :: (Ord a, Fractional a, Distribution StdUniform a) => Int -> RVar [a]
instance GHC.Show.Show (Data.Random.Distribution.Simplex.StdSimplex as)
instance GHC.Classes.Eq (Data.Random.Distribution.Simplex.StdSimplex as)
instance (GHC.Classes.Ord a, GHC.Real.Fractional a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Simplex.StdSimplex [a]

module Data.Random.Distribution.T
t :: Distribution T a => Integer -> RVar a
tT :: Distribution T a => Integer -> RVarT m a
newtype T a
T :: Integer -> T a
instance GHC.Show.Show (Data.Random.Distribution.T.T a)
instance GHC.Classes.Ord (Data.Random.Distribution.T.T a)
instance GHC.Classes.Eq (Data.Random.Distribution.T.T a)
instance (GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Normal.Normal a, Data.Random.Distribution.Distribution Data.Random.Distribution.ChiSquare.ChiSquare a) => Data.Random.Distribution.Distribution Data.Random.Distribution.T.T a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.T.T a) => Data.Random.Distribution.CDF Data.Random.Distribution.T.T a

module Data.Random.Distribution.Triangular

-- | A description of a triangular distribution - a distribution whose PDF
--   is a triangle ramping up from a lower bound to a specified midpoint
--   and back down to the upper bound. This is a very simple distribution
--   that does not generally occur naturally but is used sometimes as an
--   estimate of a true distribution when only the range of the values and
--   an approximate mode of the true distribution are known.
data Triangular a
Triangular :: a -> a -> a -> Triangular a

-- | The lower bound of the triangle in the PDF (the smallest number the
--   distribution can generate)
[triLower] :: Triangular a -> a

-- | The midpoint of the triangle (also the mode of the distribution)
[triMid] :: Triangular a -> a

-- | The upper bound of the triangle (and the largest number the
--   distribution can generate)
[triUpper] :: Triangular a -> a

-- | Compute a triangular distribution for a <a>Floating</a> type.
floatingTriangular :: (Floating a, Ord a, Distribution StdUniform a) => a -> a -> a -> RVarT m a

-- | <tt>triangularCDF a b c</tt> is the CDF of <tt>realFloatTriangular a b
--   c</tt>.
triangularCDF :: RealFrac a => a -> a -> a -> a -> Double
instance GHC.Show.Show a => GHC.Show.Show (Data.Random.Distribution.Triangular.Triangular a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Random.Distribution.Triangular.Triangular a)
instance (GHC.Float.RealFloat a, GHC.Classes.Ord a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Triangular.Triangular a
instance (GHC.Real.RealFrac a, Data.Random.Distribution.Distribution Data.Random.Distribution.Triangular.Triangular a) => Data.Random.Distribution.CDF Data.Random.Distribution.Triangular.Triangular a

module Data.Random.Distribution.Weibull
data Weibull a
Weibull :: !a -> !a -> Weibull a
[weibullLambda] :: Weibull a -> !a
[weibullK] :: Weibull a -> !a
instance GHC.Show.Show a => GHC.Show.Show (Data.Random.Distribution.Weibull.Weibull a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Random.Distribution.Weibull.Weibull a)
instance (GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Weibull.Weibull a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Weibull.Weibull a) => Data.Random.Distribution.CDF Data.Random.Distribution.Weibull.Weibull a

module Data.Random.Sample

-- | A typeclass allowing <a>Distribution</a>s and <a>RVar</a>s to be
--   sampled. Both may also be sampled via <a>runRVar</a> or
--   <a>runRVarT</a>, but I find it psychologically pleasing to be able to
--   sample both using this function, as they are two separate abstractions
--   for one base concept: a random variable.
class Sampleable d m t

-- | Directly sample from a distribution or random variable, using the
--   given source of entropy.
sampleFrom :: (Sampleable d m t, RandomSource m s) => s -> d t -> m t

-- | Sample a random variable using the default source of entropy for the
--   monad in which the sampling occurs.
sample :: (Sampleable d m t, MonadRandom m) => d t -> m t

-- | Sample a random variable in a "functional" style. Typical
--   instantiations of <tt>s</tt> are <tt>System.Random.StdGen</tt> or
--   <tt>System.Random.Mersenne.Pure64.PureMT</tt>.
sampleState :: (Sampleable d (State s) t, MonadRandom (State s)) => d t -> s -> (t, s)

-- | Sample a random variable in a "semi-functional" style. Typical
--   instantiations of <tt>s</tt> are <tt>System.Random.StdGen</tt> or
--   <tt>System.Random.Mersenne.Pure64.PureMT</tt>.
sampleStateT :: (Sampleable d (StateT s m) t, MonadRandom (StateT s m)) => d t -> s -> m (t, s)
instance Data.Random.Distribution.Distribution d t => Data.Random.Sample.Sampleable d m t
instance Data.Random.Lift.Lift m n => Data.Random.Sample.Sampleable (Data.RVar.RVarT m) n t


-- | Flexible modeling and sampling of random variables.
--   
--   The central abstraction in this library is the concept of a random
--   variable. It is not fully formalized in the standard measure-theoretic
--   language, but rather is informally defined as a "thing you can get
--   random values out of". Different random variables may have different
--   types of values they can return or the same types but different
--   probabilities for each value they can return. The random values you
--   get out of them are traditionally called "random variates".
--   
--   Most imperative-language random number libraries are all about
--   obtaining and manipulating random variates. This one is about
--   defining, manipulating and sampling random variables. Computationally,
--   the distinction is small and mostly just a matter of perspective, but
--   from a program design perspective it provides both a powerfully
--   composable abstraction and a very useful separation of concerns.
--   
--   Abstract random variables as implemented by <a>RVar</a> are
--   composable. They can be defined in a monadic / "imperative" style that
--   amounts to manipulating variates, but with strict type-level
--   isolation. Concrete random variables are also provided, but they do
--   not compose as generically. The <a>Distribution</a> type class allows
--   concrete random variables to "forget" their concreteness so that they
--   can be composed. For examples of both, see the documentation for
--   <a>RVar</a> and <a>Distribution</a>, as well as the code for any of
--   the concrete distributions such as <a>Uniform</a>, <a>Gamma</a>, etc.
--   
--   Both abstract and concrete random variables can be sampled (despite
--   the types GHCi may list for the functions) by the functions in
--   <a>Data.Random.Sample</a>.
--   
--   Random variable sampling is done with regard to a generic basis of
--   primitive random variables defined in
--   <a>Data.Random.Internal.Primitives</a>. This basis is very low-level
--   and the actual set of primitives is still fairly experimental, which
--   is why it is in the "Internal" sub-heirarchy. User-defined variables
--   should use the existing high-level variables such as <a>Uniform</a>
--   and <a>Normal</a> rather than these basis variables.
--   <a>Data.Random.Source</a> defines classes for entropy sources that
--   provide implementations of these primitive variables. Several
--   implementations are available in the Data.Random.Source.* modules.
module Data.Random

-- | An opaque type modeling a "random variable" - a value which depends on
--   the outcome of some random event. <a>RVar</a>s can be conveniently
--   defined by an imperative-looking style:
--   
--   <pre>
--   normalPair =  do
--       u &lt;- stdUniform
--       t &lt;- stdUniform
--       let r = sqrt (-2 * log u)
--           theta = (2 * pi) * t
--           
--           x = r * cos theta
--           y = r * sin theta
--       return (x,y)
--   </pre>
--   
--   OR by a more applicative style:
--   
--   <pre>
--   logNormal = exp &lt;$&gt; stdNormal
--   </pre>
--   
--   Once defined (in any style), there are several ways to sample
--   <a>RVar</a>s:
--   
--   <ul>
--   <li>In a monad, using a <a>RandomSource</a>:</li>
--   </ul>
--   
--   <pre>
--   runRVar (uniform 1 100) DevRandom :: IO Int
--   </pre>
--   
--   <ul>
--   <li>In a monad, using a <a>MonadRandom</a> instance:</li>
--   </ul>
--   
--   <pre>
--   sampleRVar (uniform 1 100) :: State PureMT Int
--   </pre>
--   
--   <ul>
--   <li>As a pure function transforming a functional RNG:</li>
--   </ul>
--   
--   <pre>
--   sampleState (uniform 1 100) :: StdGen -&gt; (Int, StdGen)
--   </pre>
--   
--   (where <tt>sampleState = runState . sampleRVar</tt>)
type RVar = RVarT Identity

-- | A random variable with access to operations in an underlying monad.
--   Useful examples include any form of state for implementing random
--   processes with hysteresis, or writer monads for implementing tracing
--   of complicated algorithms.
--   
--   For example, a simple random walk can be implemented as an
--   <a>RVarT</a> <a>IO</a> value:
--   
--   <pre>
--   rwalkIO :: IO (RVarT IO Double)
--   rwalkIO d = do
--       lastVal &lt;- newIORef 0
--       
--       let x = do
--               prev    &lt;- lift (readIORef lastVal)
--               change  &lt;- rvarT StdNormal
--               
--               let new = prev + change
--               lift (writeIORef lastVal new)
--               return new
--           
--       return x
--   </pre>
--   
--   To run the random walk it must first be initialized, after which it
--   can be sampled as usual:
--   
--   <pre>
--   do
--       rw &lt;- rwalkIO
--       x &lt;- sampleRVarT rw
--       y &lt;- sampleRVarT rw
--       ...
--   </pre>
--   
--   The same random-walk process as above can be implemented using MTL
--   types as follows (using <tt>import Control.Monad.Trans as MTL</tt>):
--   
--   <pre>
--   rwalkState :: RVarT (State Double) Double
--   rwalkState = do
--       prev &lt;- MTL.lift get
--       change  &lt;- rvarT StdNormal
--       
--       let new = prev + change
--       MTL.lift (put new)
--       return new
--   </pre>
--   
--   Invocation is straightforward (although a bit noisy) if you're used to
--   MTL:
--   
--   <pre>
--   rwalk :: Int -&gt; Double -&gt; StdGen -&gt; ([Double], StdGen)
--   rwalk count start gen = 
--       flip evalState start .
--           flip runStateT gen .
--               sampleRVarTWith MTL.lift $
--                   replicateM count rwalkState
--   </pre>
data RVarT (m :: * -> *) a :: (* -> *) -> * -> *

-- | "Run" an <a>RVar</a> - samples the random variable from the provided
--   source of entropy.
runRVar :: RandomSource m s => RVar a -> s -> m a

-- | Like <a>runRVarTWith</a>, but using an implicit lifting (provided by
--   the <a>Lift</a> class)
runRVarT :: (Lift n m, RandomSource m s) => RVarT n a -> s -> m a

-- | "Runs" an <a>RVarT</a>, sampling the random variable it defines.
--   
--   The first argument lifts the base monad into the sampling monad. This
--   operation must obey the "monad transformer" laws:
--   
--   <pre>
--   lift . return = return
--   lift (x &gt;&gt;= f) = (lift x) &gt;&gt;= (lift . f)
--   </pre>
--   
--   One example of a useful non-standard lifting would be one that takes
--   <tt>State s</tt> to another monad with a different state
--   representation (such as <tt>IO</tt> with the state mapped to an
--   <tt>IORef</tt>):
--   
--   <pre>
--   embedState :: (Monad m) =&gt; m s -&gt; (s -&gt; m ()) -&gt; State s a -&gt; m a
--   embedState get put = \m -&gt; do
--       s &lt;- get
--       (res,s) &lt;- return (runState m s)
--       put s
--       return res
--   </pre>
--   
--   The ability to lift is very important - without it, every <a>RVar</a>
--   would have to either be given access to the full capability of the
--   monad in which it will eventually be sampled (which, incidentally,
--   would also have to be monomorphic so you couldn't sample one
--   <a>RVar</a> in more than one monad) or functions manipulating
--   <a>RVar</a>s would have to use higher-ranked types to enforce the same
--   kind of isolation and polymorphism.
runRVarTWith :: RandomSource m s => (forall t. n t -> m t) -> RVarT n a -> s -> m a

-- | A <a>Distribution</a> is a data representation of a random variable's
--   probability structure. For example, in
--   <a>Data.Random.Distribution.Normal</a>, the <tt>Normal</tt>
--   distribution is defined as:
--   
--   <pre>
--   data Normal a
--       = StdNormal
--       | Normal a a
--   </pre>
--   
--   Where the two parameters of the <tt>Normal</tt> data constructor are
--   the mean and standard deviation of the random variable, respectively.
--   To make use of the <tt>Normal</tt> type, one can convert it to an
--   <a>rvar</a> and manipulate it or sample it directly:
--   
--   <pre>
--   x &lt;- sample (rvar (Normal 10 2))
--   x &lt;- sample (Normal 10 2)
--   </pre>
--   
--   A <a>Distribution</a> is typically more transparent than an
--   <a>RVar</a> but less composable (precisely because of that
--   transparency). There are several practical uses for types implementing
--   <a>Distribution</a>:
--   
--   <ul>
--   <li>Typically, a <a>Distribution</a> will expose several parameters of
--   a standard mathematical model of a probability distribution, such as
--   mean and std deviation for the normal distribution. Thus, they can be
--   manipulated analytically using mathematical insights about the
--   distributions they represent. For example, a collection of bernoulli
--   variables could be simplified into a (hopefully) smaller collection of
--   binomial variables.</li>
--   <li>Because they are generally just containers for parameters, they
--   can be easily serialized to persistent storage or read from
--   user-supplied configurations (eg, initialization data for a
--   simulation).</li>
--   <li>If a type additionally implements the <a>CDF</a> subclass, which
--   extends <a>Distribution</a> with a cumulative density function, an
--   arbitrary random variable <tt>x</tt> can be tested against the
--   distribution by testing <tt>fmap (cdf dist) x</tt> for
--   uniformity.</li>
--   </ul>
--   
--   On the other hand, most <a>Distribution</a>s will not be closed under
--   all the same operations as <a>RVar</a> (which, being a monad, has a
--   fully turing-complete internal computational model). The sum of two
--   uniformly-distributed variables, for example, is not uniformly
--   distributed. To support general composition, the <a>Distribution</a>
--   class defines a function <a>rvar</a> to construct the more-abstract
--   and more-composable <a>RVar</a> representation of a random variable.
class Distribution d t where rvar = rvarT rvarT d = lift (rvar d)

-- | Return a random variable with this distribution.
rvar :: Distribution d t => d t -> RVar t

-- | Return a random variable with the given distribution, pre-lifted to an
--   arbitrary <a>RVarT</a>. Any arbitrary <a>RVar</a> can also be
--   converted to an 'RVarT m' for an arbitrary <tt>m</tt>, using either
--   <a>lift</a> or <tt>sample</tt>.
rvarT :: Distribution d t => d t -> RVarT n t
class Distribution d t => CDF d t

-- | Return the cumulative distribution function of this distribution. That
--   is, a function taking <tt>x :: t</tt> to the probability that the next
--   sample will return a value less than or equal to x, according to some
--   order or partial order (not necessarily an obvious one).
--   
--   In the case where <tt>t</tt> is an instance of Ord, <a>cdf</a> should
--   correspond to the CDF with respect to that order.
--   
--   In other cases, <a>cdf</a> is only required to satisfy the following
--   law: <tt>fmap (cdf d) (rvar d)</tt> must be uniformly distributed over
--   (0,1). Inclusion of either endpoint is optional, though the preferred
--   range is (0,1].
--   
--   Note that this definition requires that <a>cdf</a> for a product type
--   should _not_ be a joint CDF as commonly defined, as that definition
--   violates both conditions. Instead, it should be a univariate CDF over
--   the product type. That is, it should represent the CDF with respect to
--   the lexicographic order of the product.
--   
--   The present specification is probably only really useful for testing
--   conformance of a variable to its target distribution, and I am open to
--   suggestions for more-useful specifications (especially with regard to
--   the interaction with product types).
cdf :: CDF d t => d t -> t -> Double
class Distribution d t => PDF d t where pdf d = exp . logPdf d logPdf d = log . pdf d
pdf :: PDF d t => d t -> t -> Double
logPdf :: PDF d t => d t -> t -> Double

-- | A typeclass allowing <a>Distribution</a>s and <a>RVar</a>s to be
--   sampled. Both may also be sampled via <a>runRVar</a> or
--   <a>runRVarT</a>, but I find it psychologically pleasing to be able to
--   sample both using this function, as they are two separate abstractions
--   for one base concept: a random variable.
class Sampleable d m t

-- | Directly sample from a distribution or random variable, using the
--   given source of entropy.
sampleFrom :: (Sampleable d m t, RandomSource m s) => s -> d t -> m t

-- | Sample a random variable using the default source of entropy for the
--   monad in which the sampling occurs.
sample :: (Sampleable d m t, MonadRandom m) => d t -> m t

-- | Sample a random variable in a "functional" style. Typical
--   instantiations of <tt>s</tt> are <tt>System.Random.StdGen</tt> or
--   <tt>System.Random.Mersenne.Pure64.PureMT</tt>.
sampleState :: (Sampleable d (State s) t, MonadRandom (State s)) => d t -> s -> (t, s)

-- | Sample a random variable in a "semi-functional" style. Typical
--   instantiations of <tt>s</tt> are <tt>System.Random.StdGen</tt> or
--   <tt>System.Random.Mersenne.Pure64.PureMT</tt>.
sampleStateT :: (Sampleable d (StateT s m) t, MonadRandom (StateT s m)) => d t -> s -> m (t, s)

-- | A definition of a uniform distribution over the type <tt>t</tt>. See
--   also <a>uniform</a>.
data Uniform t

-- | A uniform distribution defined by a lower and upper range bound. For
--   <a>Integral</a> and <a>Enum</a> types, the range is inclusive. For
--   <a>Fractional</a> types the range includes the lower bound but not the
--   upper.
Uniform :: !t -> !t -> Uniform t
uniform :: Distribution Uniform a => a -> a -> RVar a
uniformT :: Distribution Uniform a => a -> a -> RVarT m a

-- | A name for the "standard" uniform distribution over the type
--   <tt>t</tt>, if one exists. See also <a>stdUniform</a>.
--   
--   For <a>Integral</a> and <a>Enum</a> types that are also
--   <a>Bounded</a>, this is the uniform distribution over the full range
--   of the type. For un-<a>Bounded</a> <a>Integral</a> types this is not
--   defined. For <a>Fractional</a> types this is a random variable in the
--   range [0,1) (that is, 0 to 1 including 0 but not including 1).
data StdUniform t
StdUniform :: StdUniform t

-- | Get a "standard" uniformly distributed variable. For integral types,
--   this means uniformly distributed over the full range of the type
--   (there is no support for <a>Integer</a>). For fractional types, this
--   means uniformly distributed on the interval [0,1).
stdUniform :: (Distribution StdUniform a) => RVar a

-- | Get a "standard" uniformly distributed process. For integral types,
--   this means uniformly distributed over the full range of the type
--   (there is no support for <a>Integer</a>). For fractional types, this
--   means uniformly distributed on the interval [0,1).
stdUniformT :: (Distribution StdUniform a) => RVarT m a

-- | A specification of a normal distribution over the type <tt>a</tt>.
data Normal a

-- | The "standard" normal distribution - mean 0, stddev 1
StdNormal :: Normal a

-- | <tt>Normal m s</tt> is a normal distribution with mean <tt>m</tt> and
--   stddev <tt>sd</tt>.
Normal :: a -> a -> Normal a

-- | <tt>normal m s</tt> is a random variable with distribution
--   <tt><a>Normal</a> m s</tt>.
normal :: Distribution Normal a => a -> a -> RVar a

-- | <a>stdNormal</a> is a normal variable with distribution
--   <a>StdNormal</a>.
stdNormal :: Distribution Normal a => RVar a

-- | <tt>normalT m s</tt> is a random process with distribution
--   <tt><a>Normal</a> m s</tt>.
normalT :: Distribution Normal a => a -> a -> RVarT m a

-- | <a>stdNormalT</a> is a normal process with distribution
--   <a>StdNormal</a>.
stdNormalT :: Distribution Normal a => RVarT m a
data Gamma a
Gamma :: a -> a -> Gamma a
gamma :: (Distribution Gamma a) => a -> a -> RVar a
gammaT :: (Distribution Gamma a) => a -> a -> RVarT m a

-- | A typeclass for monads with a chosen source of entropy. For example,
--   <tt>RVar</tt> is such a monad - the source from which it is
--   (eventually) sampled is the only source from which a random variable
--   is permitted to draw, so when directly requesting entropy for a random
--   variable these functions are used.
--   
--   Minimum implementation is either the internal <a>getRandomPrim</a> or
--   all other functions. Additionally, this class's interface is subject
--   to extension at any time, so it is very, very strongly recommended
--   that the <tt>monadRandom</tt> Template Haskell function be used to
--   implement this function rather than directly implementing it. That
--   function takes care of choosing default implementations for any
--   missing functions; as long as at least one function is implemented, it
--   will derive sensible implementations of all others.
--   
--   To use <tt>monadRandom</tt>, just wrap your instance declaration as
--   follows (and enable the TemplateHaskell and GADTs language
--   extensions):
--   
--   <pre>
--   $(monadRandom [d|
--           instance MonadRandom FooM where
--               getRandomDouble = return pi
--               getRandomWord16 = return 4
--               {- etc... -}
--       |])
--   </pre>
class Monad m => MonadRandom (m :: * -> *)

-- | A source of entropy which can be used in the given monad.
--   
--   See also <a>MonadRandom</a>.
--   
--   Minimum implementation is either the internal <a>getRandomPrimFrom</a>
--   or all other functions. Additionally, this class's interface is
--   subject to extension at any time, so it is very, very strongly
--   recommended that the <tt>randomSource</tt> Template Haskell function
--   be used to implement this function rather than directly implementing
--   it. That function takes care of choosing default implementations for
--   any missing functions; as long as at least one function is
--   implemented, it will derive sensible implementations of all others.
--   
--   To use <tt>randomSource</tt>, just wrap your instance declaration as
--   follows (and enable the TemplateHaskell, MultiParamTypeClasses and
--   GADTs language extensions, as well as any others required by your
--   instances, such as FlexibleInstances):
--   
--   <pre>
--   $(randomSource [d|
--           instance RandomSource FooM Bar where
--               {- at least one RandomSource function... -}
--       |])
--   </pre>
class Monad m => RandomSource (m :: * -> *) s

-- | A token representing the "standard" entropy source in a
--   <a>MonadRandom</a> monad. Its sole purpose is to make the following
--   true (when the types check):
--   
--   <pre>
--   runRVar x StdRandom === sampleRVar
--   </pre>
data StdRandom :: *
StdRandom :: StdRandom

-- | A random variable returning an arbitrary element of the given list.
--   Every element has equal probability of being chosen. Because it is a
--   pure <a>RVar</a> it has no memory - that is, it "draws with
--   replacement."
randomElement :: [a] -> RVar a

-- | A random variable that returns the given list in an arbitrary shuffled
--   order. Every ordering of the list has equal probability.
shuffle :: [a] -> RVar [a]

-- | A random variable that shuffles a list of a known length (or a list
--   prefix of the specified length). Useful for shuffling large lists when
--   the length is known in advance. Avoids needing to traverse the list to
--   discover its length. Each ordering has equal probability.
shuffleN :: Int -> [a] -> RVar [a]

-- | A random variable that selects N arbitrary elements of a list of known
--   length M.
shuffleNofM :: Int -> Int -> [a] -> RVar [a]

module Data.Random.Distribution.Pareto
pareto :: Distribution Pareto a => a -> a -> RVar a
paretoT :: Distribution Pareto a => a -> a -> RVarT m a
data Pareto a
Pareto :: !a -> !a -> Pareto a
instance (GHC.Float.Floating a, Data.Random.Distribution.Distribution Data.Random.Distribution.Uniform.StdUniform a) => Data.Random.Distribution.Distribution Data.Random.Distribution.Pareto.Pareto a
instance (GHC.Real.Real a, Data.Random.Distribution.Distribution Data.Random.Distribution.Pareto.Pareto a) => Data.Random.Distribution.CDF Data.Random.Distribution.Pareto.Pareto a