RandomModule
PackageAxial.PlatformService
Helpers for the random-number service.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| service | Random.service | Reads the service from the environment. |
| next | Random.next | Reads a non-negative random integer from an explicit random-number service. |
| nextMax | Random.nextMax maxExclusive | Reads a random integer less than the supplied maximum from an explicit random-number service. |
| nextInt | Random.nextInt minInclusive maxExclusive | Reads a random integer from an explicit random-number service. |
| nextDouble | Random.nextDouble | Reads a random floating-point value from an explicit random-number service. |
| nextBytes | Random.nextBytes buffer | Fills a byte buffer through an explicit random-number service. |
| bytes | Random.bytes count | Creates a byte array filled through an explicit random-number service. |
| live | Random.live | Creates a live random-number generator backed by . |
| fromValue | Random.fromValue value | Creates a deterministic random generator that always returns the supplied value. |
| fromFixed | Random.fromFixed integer doubleValue byteValue | Creates a deterministic random generator from fixed integer, double, and byte values. |
| layer | Random.layer | Builds the live random-number generator as a layer. |
Reads the service from the environment.
Returns
Flow<'env, 'error, IRandom>
Reads a non-negative random integer from an explicit random-number service.
Returns
Flow<'env, 'error, int>
Reads a random integer less than the supplied maximum from an explicit random-number service.
Parameters
| Name | Type | Description |
|---|---|---|
| maxExclusive | int |
Returns
Flow<'env, 'error, int>
Reads a random integer from an explicit random-number service.
Parameters
| Name | Type | Description |
|---|---|---|
| minInclusive | int | |
| maxExclusive | int |
Returns
Flow<'env, 'error, int>
Reads a random floating-point value from an explicit random-number service.
Returns
Flow<'env, 'error, float>
Fills a byte buffer through an explicit random-number service.
Parameters
| Name | Type | Description |
|---|---|---|
| buffer | byte array |
Returns
Flow<'env, 'error, unit>
Creates a byte array filled through an explicit random-number service.
Parameters
| Name | Type | Description |
|---|---|---|
| count | int |
Returns
Flow<'env, 'error, byte array>
Creates a deterministic random generator that always returns the supplied value.
Parameters
| Name | Type | Description |
|---|---|---|
| value | int |
Returns
IRandom
Creates a deterministic random generator from fixed integer, double, and byte values.
Parameters
| Name | Type | Description |
|---|---|---|
| integer | int | |
| doubleValue | float | |
| byteValue | byte |
Returns
IRandom

