Re: Random Numbers and Banner Managers
That looks correct. You should probably also seed the random number generator. I'm not sure if you need to do this every time the code is called, but it can't hurt. Make sure you run a large test of the code's "randomness" before you conclude whether it works or not. Just create a loop that calls (or includes) the code and note the frequency of each ad. One thing I'd change, to save the calls to the ValueList() function: A simple frequencty test loop: #bid#: #freq[bid]# Jim -Original Message- From: Duane Boudreau <[EMAIL PROTECTED]> To: CFTalk <[EMAIL PROTECTED]> Date: Sunday, July 23, 2000 2:50 PM Subject: Random Numbers and Banner Managers >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? > > > SELECT BannerAdID > FROM BannerAds > WHERE Active = 1 > >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.
Re: Random Numbers and Banner Managers
Duane can you set a client variable that contains a list of already displayed banners and test against that list so they do not come up as often? Of course you might want to make a weighting table for clients that paid more to come up more often. And actually your code should be more like SELECT BannerAdID FROM BannerAds WHERE Active = 1 #q_banners.BannerAdID[myrow]# - Original Message - From: "Duane Boudreau" <[EMAIL PROTECTED]> To: "CFTalk" <[EMAIL PROTECTED]> Sent: Sunday, July 23, 2000 1:53 PM Subject: Random Numbers and Banner Managers > 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? > > > SELECT BannerAdID > FROM BannerAds > WHERE Active = 1 > > 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. > -- 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.
Random Numbers and Banner Managers
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? SELECT BannerAdID FROMBannerAds WHERE Active = 1 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.