mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	clarify random node info language
This commit is contained in:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user