You can add a random number to your query then order by that.
Try this:

<cfquery datasource="#Attributes.DataSource#" name="q_banners">
        SELECT  BannerAdID, #RandRange(1,99999)# AS "Rand"
        FROM            BannerAds
        WHERE           Active = 1
                     ORDER BY RAND
</cfquery>
<cfset variables.bid = ListGetAt(ValueList(q_banners.BannerAdID),
andRange( 1, ListLen(ValueList(q_banners.BannerAdID))))>


----------------------------------------------
Original Message
From: "Duane Boudreau"<[EMAIL PROTECTED]>
Subject: Random Numbers and Banner Managers
Date: Sun, 23 Jul 2000 16:53:52 -0400

>Hi All,
>
>I'm working on a banner manager program and I seem to be having a problem
>getting a true random number. It seems that some of the banners pop up more
>frequently than others. Here is the code I am using. Is there something
>better I could be using to generate a random number or is this as good as
it
>gets?
>
><cfquery datasource="#Attributes.DataSource#" name="q_banners">
>       SELECT  BannerAdID
>       FROM            BannerAds
>       WHERE           Active = 1
></cfquery>
><cfset variables.bid = ListGetAt(ValueList(q_banners.BannerAdID),
>andRange( 1, ListLen(ValueList(q_banners.BannerAdID))))>
>
>TIA,
>Duane Boudreau
>CFExperts.Com
>
>
>---------------------------------------------------------------------------
---
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to