Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 621557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:53:17+00:00 2026-05-13T18:53:17+00:00

I am trying to generate some test data. Say I have 1000 appointments that

  • 0

I am trying to generate some test data.

Say I have 1000 appointments that I need to allocate over a date range.

Now I need to distribute these appointments such that there are twice as many appointments per day at the end of the month as there are at the start of the month. The increase in appointments needs to increase with a consistent velocity.

So for example if there are 5 appointments on the 1st day of the month, by the end of the month we will be getting 10 appointments per day.

An appointment can only occur on a weekday.

Is there a decent algorithm that would help me to distribute these dates in this fashion?

Edit

This is the best I got so far, inspired by Henriks solution :

    private int GetNumForCurrentDate (DateTime date)
    {
        int daysInMonth = DateTime.DaysInMonth ( date.Year, date.Month );

        // x is the number of appointments on the first day
        double firstDay = this._NumPerMonth / ( ( ( ratio + 1 ) / 2 ) * daysInMonth );

        // x * ratio is the number of appointments on the last day.
        double lastDay = firstDay * ratio;

        // Interpolate a value between the first and last days
        double exactNumOnThisDay = firstDay + ( lastDay - firstDay ) * ( (double)date.Day / (double)daysInMonth );
        int numOnThisDay = Convert.ToInt32 ( Math.Truncate ( exactNumOnThisDay ) );

        // Accumulate any overflow
        this._Overflow += exactNumOnThisDay - numOnThisDay;
        if ( this._Overflow > 1 )
        {
            // Shove the overflow into our number when it gets into whole number teritory
            numOnThisDay++;
            this._Overflow--;
        }

        return numOnThisDay;
    }

It returns the number of days to allocate on a particular day given the date.
It deals with separating out the allocations to each month and handles rounding overflow, but its not quite perfect, it runs out of days to allocate on the last day, but it is good enough for now and Ive run out of time to perfect it..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:53:17+00:00Added an answer on May 13, 2026 at 6:53 pm

    x appointments on the first day, 2x the last day, so 1.5x on average.
    When there are y weekdays, x is 1000 / (1.5y).
    So 667/y on the first day, 1333/y on the last, interpolate for the days in between

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to generate a heatmap in R for some microarray data
I'm trying to generate an IPA file for test in some devices, but when
I'm trying to use the Thor::Actions template method to generate some C++ test file
I am trying to generate some Javascript for a Comet callback. The code that
We are using builder pattern to generate test data. These domain objects have relations
I'm trying to test some streaming file upload/download code that I've just written, but
I was trying to generate some plots for t, z and chi-square test. I
I have a command line script that generates some HTML that I am trying
I am trying to generate some code using CodeDom. I wanted to know if
I'm trying to generate some stubs for a WSDL (using xmlbeans) and keep running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.