Skip to content

Instantly share code, notes, and snippets.

@kbastani
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbastani/9946725 to your computer and use it in GitHub Desktop.
Save kbastani/9946725 to your computer and use it in GitHub Desktop.
// Create a list of dates to use as data points
// Count the amount of days since the creation date
int dayCount = DateTime.Now.Subtract(createdDate).Days;
// Create an index of data points and calculate linear interpolation for a given point
int[] membershipPoints = new int[dayCount];
for (int i = 0; i < membershipPoints.Length; i++)
{
// Calculate membership count using linear interpolation
membershipPoints[i] = (int)(((float)mg.members / ((float)membershipPoints.Length)) * (float)i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment