In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: You can use a bit of math to get a random value to fit into a specific range, here's how I do it: [code] result = rVal // 26 result = result + 5 [/code] Remember that SX/B only allows one operator per line, so it takes two lines to do what you might do in one with PBASIC. The first line takes the modulus of your random value, returning a result of 0 to 25 (the span of your range). The next line bumps the minimum and maximum points to re-align to your desired output. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=193221#m193228 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)