mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
clarify random node info language
This commit is contained in:
parent
b0d98cca01
commit
d32f11910b
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-random",
|
||||
"version" : "0.1.0",
|
||||
"version" : "0.1.1",
|
||||
"description" : "A Node-RED node that when triggered generates a random number between two values.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
@ -28,8 +28,10 @@
|
||||
70%
|
||||
<script type="text/x-red" data-help-name="random">
|
||||
<p>Generates a random number between a low and high value.</p>
|
||||
<p>If you return an integer it can <i>include</i> both the low and high values.</p>
|
||||
<p>If you return a floating point value it will be <i>between</i> the low and high values.</p>
|
||||
<p>If you return an integer it can <i>include</i> both the low and high values.
|
||||
<code>min <= n <= max</code></p>
|
||||
<p>If you return a floating point value it will be from the low value, up to, but
|
||||
not including the high value. <code>min <= n < max</code></p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -11,10 +11,10 @@ module.exports = function(RED) {
|
||||
this.on("input", function(msg) {
|
||||
var value;
|
||||
if (node.inte == "true" || node.inte === true) {
|
||||
value = Math.round(Number(Math.random()) * (node.high - node.low + 1) + node.low - 0.5);
|
||||
value = Math.round(Math.random() * (node.high - node.low + 1) + node.low - 0.5);
|
||||
}
|
||||
else {
|
||||
value = Number(Math.random()) * (node.high - node.low) + node.low;
|
||||
value = Math.random() * (node.high - node.low) + node.low;
|
||||
}
|
||||
RED.util.setMessageProperty(msg,node.property,value);
|
||||
node.send(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user