File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -229,13 +229,19 @@ evalGen = evalState <<< unGen
229
229
sample :: forall a . Seed -> Size -> Gen a -> Array a
230
230
sample seed sz g = evalGen (vectorOf sz g) { newSeed: seed, size: sz }
231
231
232
+ -- | Generate a single value using a randomly generated seed.
233
+ randomSampleOne :: forall a . Gen a -> Effect a
234
+ randomSampleOne gen = do
235
+ seed <- randomSeed
236
+ pure $ evalGen gen { newSeed: seed, size: 10 }
237
+
232
238
-- | Sample a random generator, using a randomly generated seed
233
239
randomSample' :: forall a . Size -> Gen a -> Effect (Array a )
234
240
randomSample' n g = do
235
241
seed <- randomSeed
236
242
pure $ sample seed n g
237
243
238
- -- | Get a random sample of 10 values
244
+ -- | Get a random sample of 10 values. For a single value, use `randomSampleOne`.
239
245
randomSample :: forall a . Gen a -> Effect (Array a )
240
246
randomSample = randomSample' 10
241
247
You can’t perform that action at this time.
0 commit comments