mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
add some more tests (and fixes for resulting bugs :-)
This commit is contained in:
@@ -18,12 +18,12 @@ module.exports = function(RED) {
|
||||
"use strict";
|
||||
function RandomNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
this.low = Number(n.low);
|
||||
this.high = Number(n.high);
|
||||
this.inte = n.inte;
|
||||
this.low = Number(n.low || 1);
|
||||
this.high = Number(n.high || 10);
|
||||
this.inte = n.inte || false;
|
||||
var node = this;
|
||||
this.on("input", function(msg) {
|
||||
if (node.inte === "true") {
|
||||
if (node.inte === true) {
|
||||
msg.payload = Math.round(Number(Math.random()) * (node.high - node.low + 1) + node.low - 0.5);
|
||||
} else {
|
||||
msg.payload = Number(Math.random()) * (node.high - node.low) + node.low;
|
||||
|
Reference in New Issue
Block a user