Popular recipes by Dom Lam http://code.activestate.com/recipes/users/1023440/2003-03-04T09:58:21-08:00ActiveState Code RecipesGenerating random intergers within a range of max & min. (Tcl) 2003-03-04T09:58:21-08:00Dom Lamhttp://code.activestate.com/recipes/users/1023440/http://code.activestate.com/recipes/186512-generating-random-intergers-within-a-range-of-max-/ <p style="color: grey"> Tcl recipe 186512 by <a href="/recipes/users/1023440/">Dom Lam</a> (<a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>). </p> <p>Here's an example on how to generate a random number between 2 numbers Based on C code, algorithm = randomNumber % ((max + 1) - min) + min Here's the tcl version using rand(): *note Change 100 to 1000 if you want a random number that goes into thousands. etc.. Also the rand() function generates a number between 0 &amp; 1. That's why one would multiply by 10 or 100 or 1000, etc..</p>