File tree Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Expand file tree Collapse file tree 1 file changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -20,33 +20,16 @@ type GenState = { newSeed :: Seed, size :: Size }
20
20
21
21
The state of the random generator monad
22
22
23
- #### ` GenOut `
24
-
25
- ``` purescript
26
- type GenOut a = { state :: GenState, value :: a }
27
- ```
28
-
29
- The output of the random generator monad
30
-
31
23
#### ` Gen `
32
24
33
25
``` purescript
34
- data Gen a
26
+ type Gen a = State GenState a
35
27
```
36
28
37
29
The random generator monad
38
30
39
31
` Gen ` is a state monad which encodes a linear congruential generator.
40
32
41
- ##### Instances
42
- ``` purescript
43
- instance functorGen :: Functor Gen
44
- instance applyGen :: Apply Gen
45
- instance applicativeGen :: Applicative Gen
46
- instance bindGen :: Bind Gen
47
- instance monadGen :: Monad Gen
48
- ```
49
-
50
33
#### ` repeatable `
51
34
52
35
``` purescript
@@ -139,6 +122,14 @@ arrayOf1 :: forall a. Gen a -> Gen (Tuple a (Array a))
139
122
140
123
Create a random generator which generates a non-empty array of random values.
141
124
125
+ #### ` listOf `
126
+
127
+ ``` purescript
128
+ listOf :: forall a. Int -> Gen a -> Gen (List a)
129
+ ```
130
+
131
+ Create a random generator which generates a list of random values of the specified size.
132
+
142
133
#### ` vectorOf `
143
134
144
135
``` purescript
@@ -159,7 +150,7 @@ uniform probability.
159
150
#### ` runGen `
160
151
161
152
``` purescript
162
- runGen :: forall a. Gen a -> GenState -> GenOut a
153
+ runGen :: forall a. Gen a -> GenState -> Tuple a GenState
163
154
```
164
155
165
156
Run a random generator
You can’t perform that action at this time.
0 commit comments