Off the top of my head I would write a routine that picks a random
time based on it's numerical equivalent with limits of 0 and 24 hrs and
using a granularity of whatever you like...from minutes down to
mill-seconds.
Then record the date on which that time is selected and the message
sent. It's easy enough to ensure that the next time selected at random is
set to the next day in the same process or not at all using an ini-file or
even a simple data file. And you can even make it fully automatic by have
it check the current date at a selected interval and not proceed until it is
the next day. All the date/time routines you need can be found in
DateUtils.pas if not in SysUtils.pas. You could even further refine it to
record the actual random times the message has been sent as far back as you
might consider necessary and not allow the same random times to be used
again if it should happen to get picked by the random number generator.
Delphi's randomizer should be good enough for something like this. But I
did have a slight problem with it when I was doing some experiments with
messages seeded inside bmp images where it seemed that about every 20th to
30th random number chosen between 0 and 255 had been chosen previously. I
found that the frequency of re-used numbers it generated went down as the
boundary numbers got further apart...more numbers...so I solved that problem
by using decimals down to four places and then rounding the time chose off
to it's whole number equivalent. In a test of ten-thousand results based on
1.0000 to 255.0000 I got the same number only once!
from Robert Meek dba Tangentals Design
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Eddie Shipman
Sent: Monday, January 09, 2006 10:01 AM
To: [email protected]
Subject: Once a Day algorithm
{D7 with Indy9}
I need to post some information to a website for a contest
ONLY once, but at a random time during the day.
Anyone have any ideas on how I can do this and not try to
submit this > 1 time per day?
I already have the form information and know how to post,
just need to get the timing correct.
__________________________________________
Yahoo! DSL - Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi