Random number generator

I checked back and the original “random” thread was closed, I used the solutions that nkrvk made and it work great randomizing general numbers . I did not however find or missed the solution to what I was looking for. The question I have is, can the code be modified to only use a select range of integers, as an example 20 to 50? I am using Arduino mega’s and would like to have a random pin for an output function of that pin.
I really like Xod. Just a hats off to all the people that work at developing it…

Assuming nkrvk node returns a number between 0 & 1 (inclusive), you could get numbers between 20 & 50 by multiplying by 30 (the difference between 20 & 50), and adding 20.


You can also use the map node. Set Smin to 0, Smax to 1, and Tmin and Tmax to 20 and 50.
Check out the patch 201-matching-ranges in the built-in tutorial for a more in-depth explanation.

Hey evgenykochetk, Thanks for the info. I appreciate ANY input from better coders. Thanks again