Skip to content

Instantly share code, notes, and snippets.

@upkarlidder
Last active September 24, 2016 00:02
Show Gist options
  • Save upkarlidder/0d007d32dc856b7c83f9a58e08d64d7f to your computer and use it in GitHub Desktop.
Save upkarlidder/0d007d32dc856b7c83f9a58e08d64d7f to your computer and use it in GitHub Desktop.
[
{
"id": "b93671f5.98624",
"type": "debug",
"z": "5d7690ec.49781",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 579.5,
"y": 236,
"wires": [
]
},
{
"id": "e9d25ae5.00b248",
"type": "inject",
"z": "5d7690ec.49781",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "5",
"crontab": "",
"once": false,
"x": 196.5,
"y": 236,
"wires": [
[
"f8c01873.0265a8"
]
]
},
{
"id": "f8c01873.0265a8",
"type": "function",
"z": "5d7690ec.49781",
"name": "",
"func": "function getRandomIntInclusive(min, max) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nvar num = getRandomIntInclusive(1, 10);\nif(num < 5){\n msg.payload = \"Number \" + num + \" is a low number\"; \n} else {\n msg.payload = \"Number \" + num + \" is a high number\"; \n}\n\nreturn msg",
"outputs": 1,
"noerr": 0,
"x": 381.5,
"y": 236,
"wires": [
[
"b93671f5.98624"
]
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment