<% Dim intLowerBound ' Lower bound of the random number range Dim intUpperBound ' Upper bound of the random number range Dim intRangeSize ' Size of the range Dim sngRandomValue ' A random value from 0 to intRangeSize Dim intRandomInteger ' Our final result - random integer to return ' Retrieve lower and upper bound requests if they're there ' o/w set to defaults of 0 and 100 If IsNumeric(Request.QueryString("lowerbound")) Then intLowerBound = CLng(Request.QueryString("lowerbound")) Else intLowerBound = 0 End If If IsNumeric(Request.QueryString("upperbound")) Then intUpperBound = CLng(Request.QueryString("upperbound")) ' Add a line to deal with default case of 0 to 0. ' This really isn't neccessary, but I do it so the ' sample doesn't default to generating a number between ' 0 and 0 and always return 0 when no bounds are provided. If intLowerBound = 0 And intUpperBound = 0 Then intUpperBound = 36 Else intUpperBound = 36 End If ' Check for people asking for a number from in an inappropriate ' range (ie: 50 to 10) and swap the bounds If intLowerBound > intUpperBound Then ' I really should've declared a temporary variable for this ' swapping, but I was lazy and this one was already defined ' and I don't use it till later... oh all right I'll do it ' the "right" way... actually even this is bad... I should've ' defined this up top... so sue me... hey it's free code what ' do you want from me? Dim iTemp iTemp = intLowerBound intLowerBound = intUpperBound intUpperBound = iTemp End If ' Initialize the random number generator. ' Randomize can actually take parameters telling it how to initialize ' things, but for the most you'll just want to call it without passing ' it anything. Randomize() ' Generate our random number. ' The Rnd function does most of the work. It returns a value in the ' range 0 <= value < 1 so to generate a random integer in the specified ' range we need to do some calculation. Specifically we take the size ' of the range in which we want to generate the number (add 1 so the ' upper bound can be generated!) and then multiply it by our random ' element. Then to place the value into the correct range of numbers ' we add the lower bound. Finally we truncate the number leaving us ' with the integer portion which is always somewhere between the ' lower bound and upper bound (inclusively). ' Find range size intRangeSize = intUpperBound - intLowerBound + 1 ' Get a random number from 0 to the size of the range sngRandomValue = intRangeSize * Rnd() ' Center the range of possible random numbers over the desired result set sngRandomValue = sngRandomValue + intLowerBound ' Convert our value to an integer intRandomInteger = Int(sngRandomValue) ' The above 4 lines are equivilent to the popular shorter version ' below. I split it up so I could indicate what each step is doing. ' intRandomInteger = Int((intUpperBound - intLowerBound + 1) * Rnd + intLowerBound) %> NO TIME TO BREATHE
   
mantras for modern minds and lives
existence distilled through words

On the right you should see one of my efforts to put my philosophies into poetry. The intention of these rhymes is to cultivate peace, stability and purpose, beyond the volatility of an everyday developed existence. Other random 'mantras' from my expanding collection can be viewed by refreshing the page.

For me, some of these rhymes are the philosophy for achieving a better existance, others just help me cope with the afflictions of a modern mind and life.

It is my hope that others too might find something in these words that speaks to their inner-being. If only a timely reminder of long forgotten truth rather than a life changing revelation. Should you find something illuminating it may be worth repeating or remembering, I find the use of contrived rhymes helps this.
   
         
   
<< back

more >>
   
re:4mist
©2006 all rights reserverd.
notimetobreathe.com

<% fp = Server.MapPath("aspcount.txt") Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.OpenTextFile(fp) ct = Clng(a.ReadLine) if Session("ct") = "" then Session("ct") = ct ct = ct + 1 a.close Set a = fs.CreateTextFile(fp, True) a.WriteLine(ct) end if a.Close Response.Write ct %>