Home | Advertising Info35 USERS CURRENTLY ONLINE   
   Site Search Contact Us Thursday, June 30, 2022  

Basic ASP Randomizer Example

RANDOMVALUE = Int((Highnumber - Lownumber + 1) * Rnd + Lownumber)

The extra code added to the Randomize function ensures that you get as random a value as possible. Without it certain numbers will show up more often than others as computers are not very good at generating random values.

You don't have to use case statements, but in this example I did. There are many things you can do with the resulting value. This is just an example of using this code to generate a simple random banner rotator. You also can use response.writes to eliminate a lot of the script tags but I wanted to keep this example simple for the newbie's. It is easier to understand this way.

This code will basically give you a random Integer from a range of 1 to 10 that you do whatever you want with like make a random banner rotator. Remember you can change the highnumber and lownumber to generate a random number within a greater range. See Usage at top of this page.

RANDOMVALUE =(Int((10 - 1 + 1) * Rnd + 1))

<% Case 1 %>
<img src="BANNER_ADS/ITSHUGE.gif">
<% Case 2 %>
<% Case 3 %>
<img src="BANNER_ADS/ITSHUGE.gif">
<% Case 4 %>
<% Case 5 %>
<img src="BANNER_ADS/ITSHUGE.gif">
<% Case 6 %>
<% Case 7 %>
<img src="BANNER_ADS/ITSHUGE.gif">
<% Case 8 %>
<% Case 9 %>
<img src="BANNER_ADS/ITSHUGE.gif">
<% Case 10 %>
<% End Select %>


   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright 1998 - 2022 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com