-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80e9660
commit 38def38
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
title: Random Float | ||
id: random-float | ||
hide_title: true | ||
slug: /transformers/system/random-float | ||
--- | ||
|
||
import { TransformerPageHeader } from '@site/src/CustomComponents/TransformerPageHeader.tsx'; | ||
|
||
import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx'; | ||
|
||
<TransformerPageHeader | ||
title="Random Float" | ||
type="float" | ||
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/random_float.go" | ||
/> | ||
|
||
## Definition | ||
|
||
The random float transformer generates a random floating point number. | ||
|
||
For example: | ||
`32.2432` | ||
|
||
By default, the random float transformer generates a floating point number with 2 digits before the decimal point and 3 digits after the decimal point. | ||
|
||
## Configurations | ||
|
||
Depending on your validations, you may want to configure the output float. The random float transformer has the following configurations: | ||
|
||
<DocsTable | ||
headers={[ | ||
'Name', | ||
'Description', | ||
'Default', | ||
'Example Input', | ||
'Example Output', | ||
]} | ||
rowData={[ | ||
{ | ||
data: [ | ||
'Preserve Length', | ||
'Preserves the length of the input float to the output float while maintaining the placement of the decimal.', | ||
'false', | ||
'1.34', | ||
'873.923', | ||
], | ||
}, | ||
{ | ||
data: [ | ||
'Digits before Decimal', | ||
'Specifies how many digits you want before the decimal place. This has a max of 9 digits. ', | ||
'2', | ||
'23.24', | ||
'94.17', | ||
], | ||
}, | ||
{ | ||
data: [ | ||
'Digits after Decimal', | ||
'Specifies how many digits you want after the decimal place. This has a max of 9 digits. ', | ||
'3', | ||
'87923.4', | ||
'34.8', | ||
], | ||
}, | ||
]} | ||
/> | ||
|
||
## Examples | ||
|
||
There are several ways you can mix-and-match configurations to get different potential random float formats. Here are some possible combinations: | ||
|
||
<DocsTable | ||
headers={[ | ||
'PreserveLength', | ||
'Digits before Decimal', | ||
'Digits after Decimal', | ||
'Example Input', | ||
'Example Output', | ||
]} | ||
rowData={[ | ||
{ | ||
data: ['false', 'N/A', 'N/A', '89.232', '23.824'], | ||
}, | ||
{ | ||
data: ['true', '4', '1', '2.344', '9.813'], | ||
}, | ||
{ | ||
data: ['true', '2', '3', '678.23', '54.129'], | ||
}, | ||
]} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters