{"library":"node-red-node-random","title":"Node-RED Random Number Generator","description":"The `node-red-node-random` package provides a Node-RED node that generates random numbers based on configurable minimum and maximum values. It is a fundamental utility node for introducing variability into Node-RED flows, suitable for simulations, testing, or dynamic control systems. The node, currently at version 0.4.1 (though the GitHub repository indicates releases up to 0.8.0), is actively maintained by the Node-RED project. It allows for generating either integers within an inclusive range (`min <= n <= max`) or floating-point numbers within a range that is inclusive of the minimum but exclusive of the maximum (`min <= n < max`). A key differentiator is its ability to accept dynamic 'From' and 'To' values via `msg.from` and `msg.to` properties, although hardcoded node configurations take precedence. It's released as part of the `node-red-nodes` collection, which typically sees updates aligned with Node-RED core releases or as needed for individual nodes.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-red-node-random"],"cli":null},"imports":["Install via Node-RED Palette Manager or `npm install node-red-node-random` in your user directory (~/.node-red), then drag the 'Random' node from the palette into a flow.","{ \"id\": \"<node-id>\", \"type\": \"random\", \"name\": \"My Random Number\", \"low\": \"0\", \"high\": \"100\", \"integers\": \"true\" }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"[{\"id\":\"d90d8a28.66d5b\",\"type\":\"inject\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Trigger Random Number\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":160,\"y\":100,\"wires\":[[\"e8f9a0b1.c2d3e4f5\"]]},{\"id\":\"e8f9a0b1.c2d3e4f5\",\"type\":\"random\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Random Integer (1-10)\",\"low\":\"1\",\"high\":\"10\",\"integers\":\"true\",\"property\":\"payload\",\"x\":440,\"y\":100,\"wires\":[[\"f9a0b1c2.d3e4f5a6\"]]},{\"id\":\"f9a0b1c2.d3e4f5a6\",\"type\":\"debug\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Output Debug\",\"active\":true,\"toside\":\"true\",\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"statusVal\":\"\",\"statusType\":\"auto\",\"x\":700,\"y\":100,\"wires\":[]},{\"id\":\"1b2c3d4e.5f6a7b8c\",\"type\":\"inject\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Trigger Dynamic Float (0-1)\",\"props\":[{\"p\":\"from\",\"v\":\"0\",\"vt\":\"num\"},{\"p\":\"to\",\"v\":\"1\",\"vt\":\"num\"},{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":160,\"y\":160,\"wires\":[[\"2c3d4e5f.6a7b8c9d\"]]},{\"id\":\"2c3d4e5f.6a7b8c9d\",\"type\":\"random\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Random Float (dynamic)\",\"low\":\"0\",\"high\":\"100\",\"integers\":\"false\",\"property\":\"payload\",\"x\":440,\"y\":160,\"wires\":[[\"3d4e5f6a.7b8c9d0e\"]]},{\"id\":\"3d4e5f6a.7b8c9d0e\",\"type\":\"debug\",\"z\":\"a8b2c3d4e5f6g7h8\",\"name\":\"Output Debug Dynamic\",\"active\":true,\"toside\":\"true\",\"console\":false,\"tostatus\":false,\"complete\":\"payload\",\"targetType\":\"msg\",\"statusVal\":\"\",\"statusType\":\"auto\",\"x\":700,\"y\":160,\"wires\":[]}]","lang":"json","description":"This Node-RED flow demonstrates two uses of the Random node: generating a static random integer between 1 and 10, and generating a dynamic floating-point number between 0 and 1, overriding the node's hardcoded range using `msg.from` and `msg.to`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}