mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
|
|
<script type="text/x-red" data-template-name="random">
|
|
<div class="form-row">
|
|
<label for="node-input-inte"><i class="fa fa-random"></i> Generate</label>
|
|
<select type="text" id="node-input-inte" style="width: 300px;">
|
|
<option value="true">a whole number - integer</option>
|
|
<option value="false">a real number - floating point</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-low"><i class="fa fa-arrow-down"></i> From</label>
|
|
<input type="text" id="node-input-low" placeholder="lowest number" style="width: 300px;">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-high"><i class="fa fa-arrow-up"></i> To</label>
|
|
<input type="text" id="node-input-high" placeholder="highest number" style="width: 300px;">
|
|
</div>
|
|
<br/>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name" style="width: 300px;">
|
|
</div>
|
|
</script>
|
|
|
|
<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>
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('random',{
|
|
category: 'function',
|
|
color:"#E2D96E",
|
|
defaults: {
|
|
name: {value:""},
|
|
low: {value:"1"},
|
|
high: {value:"6"},
|
|
inte: {value:"true"}
|
|
},
|
|
inputs:1,
|
|
outputs:1,
|
|
icon: "debug.png",
|
|
label: function() {
|
|
return this.name||"random";
|
|
},
|
|
labelStyle: function() {
|
|
return this.name?"node_label_italic":"";
|
|
}
|
|
});
|
|
</script>
|