Maybe this might work ...
A random number is always a word variable.
The value is always between 1-65535.
So if the 1-65535 is considered the Decimal part, then multiplying it times the range you want (in your case 20) and take the High Word result, then add the minimum...
Code:Value VAR WORD RND VAR WORD MinCnt CON 10 MaxCnt CON 30 Scale CON MaxCnt - MinCnt RND = 1234 ; The Seed, however you get it RANDOM RND Value = (RND ** Scale) + MinCnt
Bookmarks