Last active
August 29, 2015 13:58
-
-
Save kbastani/9946725 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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