Skip to content

Commit

Permalink
random float docs
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Nov 13, 2023
1 parent 80e9660 commit 38def38
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
93 changes: 93 additions & 0 deletions docs/docs/transformers/system/random-float.mdx
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'],
},
]}
/>
5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ const sidebars = {
id: 'transformers/system/random-bool',
label: 'Random Boolean',
},
{
type: 'doc',
id: 'transformers/system/random-float',
label: 'Random Float',
},
],
},
{
Expand Down
3 changes: 3 additions & 0 deletions docs/src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { MdPassword } from 'react-icons/md';
import { PiArrowsSplitLight, PiFlaskLight } from 'react-icons/pi';
import { RxAvatar, RxComponentBoolean } from 'react-icons/rx';
import { SiKubernetes } from 'react-icons/si';
import { TbDecimal } from 'react-icons/tb';
import styles from './styles.module.css';

export default function DocSidebarItemLink({
Expand Down Expand Up @@ -142,6 +143,8 @@ export const RenderIcon = (name) => {
return <BsGenderAmbiguous />;
case 'Random Boolean':
return <RxComponentBoolean />;
case 'Random Float':
return <TbDecimal />;
default:
return <LayersIcon />;
}
Expand Down

0 comments on commit 38def38

Please sign in to comment.