Re: ad weights

2004-05-19 Thread Michael Dinowitz
Your first solution would run into the problem of having a huge amount of low
ads and few high ones. Lets say a banner system has 8 free ads and 5 paying
ones. showing the paying ones multiple times (lets say 5 per) will result in 33
total ads with the free ads having a 3% view rate and the pay having a 15%. Now
take it further. 90 free ads and 2 pay ads with the pay ads having the same 5
per. This results in each free ad having 1% and the pay ads having 5%. Pay ads
are still higher, but if you look at the full numbers you see that 9 times out
of 10 a free ad will be shown. Not very economical.

The second also shows the problems of randomness. I'd personally reverse the
second some and have 3 categories. The first is free with a 20% chance of
showing an ad, the second is affiliate with a 30% chance of showing an ad and
the final is pay with a 50% chance of showing an ad. In each category are ads
which will be randomly displayed, but the overall chance of getting one category
over another is set.

 I recently set up two photo galleries using two different mechanisms.

 The first used ratings (iTunes style) to prioritize.5 stars meant 5 times
 the frequency of a 1 star photo.That worked well.I cached a list of Ids
 (with 5 star photos being listed 5 times), in the app scope, picked an index
 at random when I needed an image, and then used the ID at that index to
 fetch the actual image data.That way I didn't have to store the image data
 5 times for 5 star photos.This works well for screensaver or slideshow
 type apps, where you just want a random photo, and you want one you like
 more often than not.

 The second organized the photos into directories (conceptually, at least).
 To select a photo, first a directory was selected at random (no weighting),
 and then an image was selected from that directory at random (again, with no
 weighting).You could certainly weight the categories differently, and even
 the individual items, but that's a lot of nastiness, potentially.This
 works well if you want to control distribution across the categories, but
 not necessarily individual images.

 I think the latter is basically what you're describing at the end of your
 message.

 Cheers,
 barneyb

  -Original Message-
  From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, May 18, 2004 2:08 PM
  To: CF-Talk
  Subject: ad weights
 
  Here's a fun task. I'm building pay per click ads for HoF (in
  place of banner
  ads and yes, the list ads are coming off). One thing is that
  I need to give each
  ad a weight in relation to another to show how often it
  should come up. I've
  thought of a few ideas and wanted to hear what others think.
  Basically, there's a table of ads that's dumped into an
  application array for
  caching. The question is, how to dump the ads in order to
  give 'high paying' ads
  more show than 'low paying' (or free) ads.
  This is one idea:
  When this table is dumped into an application array, a
  position in the array is
  given for each ad for each dollar (or part) it has.
 .01 is 1 position.
 $1 is 1 position.
 $1.01 is 2 positions.
  This is rather simple and works well for small amounts of
  ads, but when you get
  a lot, it fails.
  ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104
  items. The big
  paying ad has a greater chance of being seen in relation to
  any other ad, but is
  buried under all the low paying ads.
  Another idea is to have sub arrays for each price grouping.
  In this example, the
  chances of a $5 text ad coming up is far greater than a $1 ad
  and if a $5 comes
  up, then it'll be one of several $5 ads. This may work and
  I'm building it now.
  Critique?



 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: ad weights

2004-05-19 Thread Burns, John D
An idea that I had may be to hold some sort of structure with the ad
information and a value for priority.Each time the ad is shown (by
random selection), the priority gets bumped down one. (ie. Priority
starts at 5 for an expensive ad meaning it gets shown 5 times for every
1 time that a cheap ad is shown)Once it hits 0 it's removed from the
struct altogether to ensure that all ads get shown.Once all ads have
been shown and there's nothing left in the structure, you would re-query
the original ad list and reset the priority number and start all over
again.

Ads
-adID
-adLink
-adImage
-adPriority

This should support a ton of ads and give a sure-fire way for everyone
to be seen and not put it at chance that the cheap ads might get seen in
between all of the expensive ads, however, the expensive ones would
still get seen more often.

John Burns 

-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 5:08 PM
To: CF-Talk
Subject: ad weights

Here's a fun task. I'm building pay per click ads for HoF (in place of
banner ads and yes, the list ads are coming off). One thing is that I
need to give each ad a weight in relation to another to show how often
it should come up. I've thought of a few ideas and wanted to hear what
others think.
Basically, there's a table of ads that's dumped into an application
array for caching. The question is, how to dump the ads in order to give
'high paying' ads more show than 'low paying' (or free) ads.
This is one idea:
When this table is dumped into an application array, a position in the
array is given for each ad for each dollar (or part) it has.
 .01 is 1 position.
 $1 is 1 position.
 $1.01 is 2 positions.
This is rather simple and works well for small amounts of ads, but when
you get a lot, it fails.
ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The
big paying ad has a greater chance of being seen in relation to any
other ad, but is buried under all the low paying ads.
Another idea is to have sub arrays for each price grouping. In this
example, the chances of a $5 text ad coming up is far greater than a $1
ad and if a $5 comes up, then it'll be one of several $5 ads. This may
work and I'm building it now.
Critique?
--
Michael Dinowitz
House of Fusion
http://www.houseoffusion.com
Finding technical solutions to the problems you didn't know you had yet
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: ad weights

2004-05-19 Thread Ryan Kime
Just thought I would throw out a different angle...

 
Instead of assigning weights to each ad, why not assign it to a weight
range? For instance, your cheapest ad is $.01 and your biggest ad is $10.00
(which is constantly in flux). Take the range and divide it into however
many groups you want, say 10 for consistency's sake. Then come up with a
priority algorithm for the 10 groups (taking into account a possible 0 ads
in a group). So your ad at $4.01 would be in group 5, but if the top got
bumped up to $10.10 it would bump it down to group 4.

 
So your example of 99 $.01 and one $5 ad would show a high priority to the
$5 ad and a lesser chance to be seen at the $.01 rate as group 1 would not
have as much exposure.

 
Ryan Kime
 mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
Web Developer
Webco Industries

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 4:08 PM
To: CF-Talk
Subject: ad weights

Here's a fun task. I'm building pay per click ads for HoF (in place of
banner
ads and yes, the list ads are coming off). One thing is that I need to give
each
ad a weight in relation to another to show how often it should come up. I've
thought of a few ideas and wanted to hear what others think.
Basically, there's a table of ads that's dumped into an application array
for
caching. The question is, how to dump the ads in order to give 'high paying'
ads
more show than 'low paying' (or free) ads.
This is one idea:
When this table is dumped into an application array, a position in the array
is
given for each ad for each dollar (or part) it has.
 .01 is 1 position.
 $1 is 1 position.
 $1.01 is 2 positions.
This is rather simple and works well for small amounts of ads, but when you
get
a lot, it fails.
ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The big
paying ad has a greater chance of being seen in relation to any other ad,
but is
buried under all the low paying ads.
Another idea is to have sub arrays for each price grouping. In this example,
the
chances of a $5 text ad coming up is far greater than a $1 ad and if a $5
comes
up, then it'll be one of several $5 ads. This may work and I'm building it
now.
Critique?
--
Michael Dinowitz
House of Fusion
http://www.houseoffusion.com
Finding technical solutions to the problems you didn't know you had yet 
_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: ad weights

2004-05-19 Thread Jim McAtee
- Original Message - 
From: Michael Dinowitz [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 1:03 AM
Subject: Re: ad weights

 Your first solution would run into the problem of having a huge amount
of low
 ads and few high ones. Lets say a banner system has 8 free ads and 5
paying
 ones. showing the paying ones multiple times (lets say 5 per) will
result in 33
 total ads with the free ads having a 3% view rate and the pay having a
15%. Now
 take it further. 90 free ads and 2 pay ads with the pay ads having the
same 5
 per. This results in each free ad having 1% and the pay ads having 5%.
Pay ads
 are still higher, but if you look at the full numbers you see that 9
times out
 of 10 a free ad will be shown. Not very economical.

Neither were suggestions of how you should weight your ads, just how you
might approach it.Probably the only monkey wrench in your situation are
the free ads and the fact that a large number of them can take up a
disproportianate percentage of your rotation.I think you've got two
basic approaches.

One, weight the paying ads very very heavily in relation to non-paying
ads.For instance:

Ad_IDPriceWeight
-
1 $0.001
2 $0.055000
3 $0.001
4 $0.011000
5 $5.0050
6 $0.2525000

But you can still run into the problem of a very large number of the free
ads taking up perhaps more views in the rotation than you like.If that
happened you'd have to go through and further bump up the weighting of the
pay ads.

The second approach (which you hinted at in your original posting) would
be to make the weighting hierarchical.In your case you'd probably just
need two levels.At the first level create two 'groups' - paying and
non-paying ads.Throw all free ads into one group.You could weight the
ads within the free group in relation to each other, but it's probably
unnecessary and every ad could have an equal weight of '1'.

Into the second group, have your paying ads, weighted relative only to
other ads in the same group.Here you could probably just use a weighting
in proportion to the price of each - a $1.00 ad with a weight 10x that of
a $0.10 ad, for example.

Then weight the groups relative to each other.Say paying ads 75%,
non-paying 25% (or whatever).Then it doesn't matter how many non-paying
ads you have, they always take up a known percentage of the views in your
rotation.You're algorithm would make two picks - first select a group,
then select an ad within the group.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: ad weights

2004-05-18 Thread Matt Liotta
I think you need to provide more information. It is easy enough to 
order ads based on some sort of weight, but how does that weight change 
after the ad is served? Should an expensive ad be served twice as many 
times as an inexpensive ad? Three times? What about a moderately priced 
ad? Should it be served twice as many times as an inexpensive ad, but 
half as much as an expensive ad?

-Matt

On May 18, 2004, at 5:08 PM, Michael Dinowitz wrote:

 Here's a fun task. I'm building pay per click ads for HoF (in place of 
 banner
ads and yes, the list ads are coming off). One thing is that I need 
 to give each
ad a weight in relation to another to show how often it should come 
 up. I've
thought of a few ideas and wanted to hear what others think.
Basically, there's a table of ads that's dumped into an application 
 array for
caching. The question is, how to dump the ads in order to give 'high 
 paying' ads
more show than 'low paying' (or free) ads.
This is one idea:
When this table is dumped into an application array, a position in 
 the array is
given for each ad for each dollar (or part) it has.
    .01 is 1 position.
    $1 is 1 position.
    $1.01 is 2 positions.
This is rather simple and works well for small amounts of ads, but 
 when you get
a lot, it fails.
ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. 
 The big
paying ad has a greater chance of being seen in relation to any other 
 ad, but is
buried under all the low paying ads.
Another idea is to have sub arrays for each price grouping. In this 
 example, the
chances of a $5 text ad coming up is far greater than a $1 ad and if 
 a $5 comes
up, then it'll be one of several $5 ads. This may work and I'm 
 building it now.
Critique?
--
Michael Dinowitz
House of Fusion
http://www.houseoffusion.com
Finding technical solutions to the problems you didn't know you had 
 yet

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: ad weights

2004-05-18 Thread Barney Boisvert
I recently set up two photo galleries using two different mechanisms.

The first used ratings (iTunes style) to prioritize.5 stars meant 5 times
the frequency of a 1 star photo.That worked well.I cached a list of Ids
(with 5 star photos being listed 5 times), in the app scope, picked an index
at random when I needed an image, and then used the ID at that index to
fetch the actual image data.That way I didn't have to store the image data
5 times for 5 star photos.This works well for screensaver or slideshow
type apps, where you just want a random photo, and you want one you like
more often than not.

The second organized the photos into directories (conceptually, at least).
To select a photo, first a directory was selected at random (no weighting),
and then an image was selected from that directory at random (again, with no
weighting).You could certainly weight the categories differently, and even
the individual items, but that's a lot of nastiness, potentially.This
works well if you want to control distribution across the categories, but
not necessarily individual images.

I think the latter is basically what you're describing at the end of your
message.

Cheers,
barneyb

 -Original Message-
 From: Michael Dinowitz [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, May 18, 2004 2:08 PM
 To: CF-Talk
 Subject: ad weights
 
 Here's a fun task. I'm building pay per click ads for HoF (in 
 place of banner
 ads and yes, the list ads are coming off). One thing is that 
 I need to give each
 ad a weight in relation to another to show how often it 
 should come up. I've
 thought of a few ideas and wanted to hear what others think.
 Basically, there's a table of ads that's dumped into an 
 application array for
 caching. The question is, how to dump the ads in order to 
 give 'high paying' ads
 more show than 'low paying' (or free) ads.
 This is one idea:
 When this table is dumped into an application array, a 
 position in the array is
 given for each ad for each dollar (or part) it has.
.01 is 1 position.
$1 is 1 position.
$1.01 is 2 positions.
 This is rather simple and works well for small amounts of 
 ads, but when you get
 a lot, it fails.
 ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 
 items. The big
 paying ad has a greater chance of being seen in relation to 
 any other ad, but is
 buried under all the low paying ads.
 Another idea is to have sub arrays for each price grouping. 
 In this example, the
 chances of a $5 text ad coming up is far greater than a $1 ad 
 and if a $5 comes
 up, then it'll be one of several $5 ads. This may work and 
 I'm building it now.
 Critique?
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: ad weights

2004-05-18 Thread Ben Doom
 caching. The question is, how to dump the ads in order to give 'high 
 paying' ads
 more show than 'low paying' (or free) ads.
 This is one idea:
 When this table is dumped into an application array, a position in the 
 array is
 given for each ad for each dollar (or part) it has.
.01 is 1 position.
$1 is 1 position.
$1.01 is 2 positions.
 This is rather simple and works well for small amounts of ads, but when 
 you get
 a lot, it fails.
 ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The big
 paying ad has a greater chance of being seen in relation to any other 
 ad, but is
 buried under all the low paying ads.

A variation on this would be to have an array of structs like this:

ads[n]	[min]
	[max]
	[ad_stuff]

Where min and max are the minimum and maximum values where your random 
number will hit (for random number n, display this ad if min=n=max). 
Then you can do a binary or smart search, which will be pretty fast. 
Cache the result for 15 or 30 (or 5) seconds in the application scope, 
and you'll avoid having to do the search (the slow bit) too often (just 
a simple time compare).

 Another idea is to have sub arrays for each price grouping. In this 
 example, the
 chances of a $5 text ad coming up is far greater than a $1 ad and if a 
 $5 comes
 up, then it'll be one of several $5 ads. This may work and I'm building 
 it now.
 Critique?

Without knowing how you plan on weighting the dollar values, I can't 
comment too much.

However, you could do something similar to what I've listed above.

Another idea might be instead of min/max wieghting (by probability) you 
create an actual hard number of displays per cycle where a cycle 
includes all the assigned displays of all ads.That is, instead of a 
min and max, you have a displaycount, and you decrement it every time 
that ad is displayed.When it hits 0, remove the array row.When the 
array is empty, refresh it.

--BenD
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: ad weights

2004-05-18 Thread Mark W. Breneman
One real simple idea would be to add the weighted ads to your array X times
in random slots. Then all you have to decide is how many times you want
the add to show up value of X.

This maybe way too simple for the complexity of what this ad system sounds
like.

Mark W. Breneman
-Cold Fusion Developer
-Network Administrator
Vivid Media
[EMAIL PROTECTED]
www.vividmedia.com
608.270.9770

_

From: Michael Dinowitz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 4:08 PM
To: CF-Talk
Subject: ad weights

Here's a fun task. I'm building pay per click ads for HoF (in place of
banner
ads and yes, the list ads are coming off). One thing is that I need to give
each
ad a weight in relation to another to show how often it should come up. I've
thought of a few ideas and wanted to hear what others think.
Basically, there's a table of ads that's dumped into an application array
for
caching. The question is, how to dump the ads in order to give 'high paying'
ads
more show than 'low paying' (or free) ads.
This is one idea:
When this table is dumped into an application array, a position in the array
is
given for each ad for each dollar (or part) it has.
 .01 is 1 position.
 $1 is 1 position.
 $1.01 is 2 positions.
This is rather simple and works well for small amounts of ads, but when you
get
a lot, it fails.
ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The big
paying ad has a greater chance of being seen in relation to any other ad,
but is
buried under all the low paying ads.
Another idea is to have sub arrays for each price grouping. In this example,
the
chances of a $5 text ad coming up is far greater than a $1 ad and if a $5
comes
up, then it'll be one of several $5 ads. This may work and I'm building it
now.
Critique?
--
Michael Dinowitz
House of Fusion
http://www.houseoffusion.com
Finding technical solutions to the problems you didn't know you had yet

_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: ad weights

2004-05-18 Thread Erik Yowell
Another issue that commonly comes up in rotation is the volume of
traffic/views. The weight doesn't serve much of a purpose unless it'
compared to the aggregation of traffic totals. At least (I believe)
that's how the heavies do it (Doubleclick, etc.) I think they track
traffic for an arbitrary period (lets say 7 days)and use that value as
a basis for weighting the ad distribution.

Erik Yowell

[EMAIL PROTECTED]

http://www.shortfusemedia.com

-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 2:08 PM
To: CF-Talk
Subject: ad weights

Here's a fun task. I'm building pay per click ads for HoF (in place of
banner
ads and yes, the list ads are coming off). One thing is that I need to
give each
ad a weight in relation to another to show how often it should come up.
I've
thought of a few ideas and wanted to hear what others think.
Basically, there's a table of ads that's dumped into an application
array for
caching. The question is, how to dump the ads in order to give 'high
paying' ads
more show than 'low paying' (or free) ads.
This is one idea:
When this table is dumped into an application array, a position in the
array is
given for each ad for each dollar (or part) it has.
 .01 is 1 position.
 $1 is 1 position.
 $1.01 is 2 positions.
This is rather simple and works well for small amounts of ads, but when
you get
a lot, it fails.
ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The
big
paying ad has a greater chance of being seen in relation to any other
ad, but is
buried under all the low paying ads.
Another idea is to have sub arrays for each price grouping. In this
example, the
chances of a $5 text ad coming up is far greater than a $1 ad and if a
$5 comes
up, then it'll be one of several $5 ads. This may work and I'm building
it now.
Critique?
--
Michael Dinowitz
House of Fusion
http://www.houseoffusion.com
Finding technical solutions to the problems you didn't know you had yet

_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: ad weights

2004-05-18 Thread Jim McAtee
- Original Message - 
From: Michael Dinowitz [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, May 18, 2004 3:08 PM
Subject: ad weights

 Here's a fun task. I'm building pay per click ads for HoF (in place of
banner
 ads and yes, the list ads are coming off). One thing is that I need to
give each
 ad a weight in relation to another to show how often it should come up.
I've
 thought of a few ideas and wanted to hear what others think.
 Basically, there's a table of ads that's dumped into an application
array for
 caching. The question is, how to dump the ads in order to give 'high
paying' ads
 more show than 'low paying' (or free) ads.
 This is one idea:
 When this table is dumped into an application array, a position in the
array is
 given for each ad for each dollar (or part) it has.
.01 is 1 position.
$1 is 1 position.
$1.01 is 2 positions.
 This is rather simple and works well for small amounts of ads, but when
you get
 a lot, it fails.
 ex: 99 ads at .01 and 1 ad at $5 will equal an array of 104 items. The
big
 paying ad has a greater chance of being seen in relation to any other
ad, but is
 buried under all the low paying ads.
 Another idea is to have sub arrays for each price grouping. In this
example, the
 chances of a $5 text ad coming up is far greater than a $1 ad and if a
$5 comes
 up, then it'll be one of several $5 ads. This may work and I'm building
it now.
 Critique?

You've got two problems.First, how to represent the data so that you can
easily (and quikly) grab an ad according to some weighting scheme.
Secondly, coming up with the weighting scheme itself.

Don't use an approach where you populate an array, list or table with some
number of duplicate records relative to a weighting.This gets kinda
silly.If you had just two ads, for instance, the first of which you want
to come up 100 times as often as the other, you end up with 101 records
that represent just two entities.

Here's one approach:Assuming the weights you store are relative, you
generate two numbers for each ad.

Say you start with the following in your database:

Ad_IDWeight

175
21
325
410
55

Your generated data structure would look like

Ad_IDRange_BegRange_End
---
11 75
27676
377101
4102111
5112116

To pull up a random ad according to its weight, generate a random number
between 1 and 116 and see which record owns the number.If you stored
the above as a cached query, then you could use a query of a query to grab
one.

SELECT Ad_ID
FROM cached_ad_qry
WHERE #RandRange(1, 116)# BETWEEN Range_Beg AND Range_End

As far as the weighting scheme itself goes...

The biggest question is probably whether you want the weighting to be
directly proportional to the price paid.For example:

Ad_IDPriceWeight
-
1$5.00500
2$0.011
3$0.2525
4$0.1010
5$0.055

If you _don't_ want to weight proportionately to the price, you'll need to
come up with a way to shift the weighting, but you still probably want to
base it on pricing.You might do something like

Ad Price RangeWeight
-
$0.001
$0.01 - $0.022
$0.03 - $0.103
$0.11 - $0.505
$0.51 - $0.9910
$1.00 - $1.9918
$2.00 - $4.9930
$5.00+ 50

or

Ad Price RangeWeight
-
$0.001
$0.01 - $0.991.75 * (price * 100)
$1.00 - $2.001.50 * (price * 100)
$2.01 - $3.001.25 * (price * 100)
$3.00+ 1.00 * (price * 100)

I have no idea how either of these particular weighting schemes would work
out for you, but it should give you some ideas.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: ad weights

2004-05-18 Thread Gonzo Rock
Jim Rocks!

At 04:25 PM 5/18/04, you wrote:
- Original Message -
From: Michael Dinowitz [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Tuesday, May 18, 2004 3:08 PM
Subject: ad weights

  up, then it'll be one of several $5 ads. This may work and I'm building 
 it now.
  Critique?

You've got two problems.First, how to represent the data so that you can
easily (and quikly) grab an ad according to some weighting scheme.
Secondly, coming up with the weighting scheme itself.

Don't use an approach where you populate an array, list or table with some
number of duplicate records relative to a weighting.This gets kinda
silly.If you had just two ads, for instance, the first of which you want
to come up 100 times as often as the other, you end up with 101 records
that represent just two entities.

Here's one approach:Assuming the weights you store are relative, you
generate two numbers for each ad.

Say you start with the following in your database:

Ad_IDWeight

175
21
325
410
55

Your generated data structure would look like

Ad_IDRange_BegRange_End
---
11 75
27676
377101
4102111
5112116

To pull up a random ad according to its weight, generate a random number
between 1 and 116 and see which record owns the number.If you stored
the above as a cached query, then you could use a query of a query to grab
one.

SELECT Ad_ID
FROM cached_ad_qry
WHERE #RandRange(1, 116)# BETWEEN Range_Beg AND Range_End

As far as the weighting scheme itself goes...

The biggest question is probably whether you want the weighting to be
directly proportional to the price paid.For example:

Ad_IDPriceWeight
-
1$5.00500
2$0.011
3$0.2525
4$0.1010
5$0.055

If you _don't_ want to weight proportionately to the price, you'll need to
come up with a way to shift the weighting, but you still probably want to
base it on pricing.You might do something like

Ad Price RangeWeight
-
$0.001
$0.01 - $0.022
$0.03 - $0.103
$0.11 - $0.505
$0.51 - $0.9910
$1.00 - $1.9918
$2.00 - $4.9930
$5.00+ 50

or

Ad Price RangeWeight
-
$0.001
$0.01 - $0.991.75 * (price * 100)
$1.00 - $2.001.50 * (price * 100)
$2.01 - $3.001.25 * (price * 100)
$3.00+ 1.00 * (price * 100)

I have no idea how either of these particular weighting schemes would work
out for you, but it should give you some ideas.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]