...
Source Code
Code Block | ||
---|---|---|
| ||
letfunction execute() { const min = parseFloat(inPorts[1].value) === undefined ? 0 : parseFloat(inPorts[1].value); letconst max = parseFloat(inPorts[2].value) === undefined ? 0 : parseFloat(inPorts[2].value); let const resolution = parseFloat(inPorts[3].value) === undefined ? 0 : parseFloat(inPorts[3].value); if (resolution === 0) { return [Math.floor((Math.random() * (max - min + 1)) + min)]; } return [(Math.random() * (max - min) + min).toFixed(resolution)]; } |
...
In Ports
Position | Name | Message Type | Description |
---|---|---|---|
1 | Trigger | Trigger | This port is being used to trigger the 'Random Number' object. |
2 | Min | Number | This port is being used to receive a message containing the min number for the 'Random Number' object. |
3 | Max | Number | This port is being used to receive a message containing the max number for the 'Random Number' object. |
4 | Resolution | Number | This port is being used to receive a message containing the resolution for the 'Random Number' object. |
...