Here's a problem I was faced with just yesterday, so I thought I'd share it with you. I'm not posting my answer to the problem as that will encourage others to offer their suggestions, but I'd like to point out that the problem is simply-stated, requires no advanced math, and is substantially easier if you have a medium-strong background in mathematics. It comes from an upgrade I'm preparing for my automated blog posting software.
Problem Statement
One of my clients is posting to a blog using my automated blog posting program to a blog run by a blogging club. Club rules state that posts may not happen more than once per 24 hours. The program currently allows users to choose posting
From X to Y times per Z days and spreads out the posting accordingly. Now, this means that sometimes posting happens a couple of times a day and then not again for a couple of days -- or any combination of things. Make an algorithm that will post the given number of times per the given time period with each post being on different days.
Example Post from 4 to 7 times per 7 days
Currently the program randomly chooses to post, say 5 times per 7 days. That could be 2 posts on day 1, 1 post on day 4, and 2 posts on day 7.
Again, I have a solution -- I'm just withholding posting for a couple of days to see what others suggest.
Here's what the client suggested -- do you see what's wrong?
Quote:
|
Force the system to compare the "day" it is supposed to post and if it is equal == then maybe make it "add a day". Like if it is 7 and next post is also 7, then force it to add one to rewrite it to day 8.
|