Last active
May 26, 2016 16:09
-
-
Save simonbromberg/5c6d9dbb39d72cede37ba20703499791 to your computer and use it in GitHub Desktop.
Calculate histogram data
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
- (void)getMax:(float *)max min:(float *)min on:(NSArray *)arr { | |
for (NSNumber *num in arr) { | |
*max = MAX(*max, num.floatValue); | |
*min = MIN(*min, num.floatValue); | |
} | |
} | |
- (int)indexForResponse:(float)response max:(float)max min:(float)min bucketCount:(int)count { | |
float bucketWidth = (max - min) / count; | |
return floorf((response - min) / bucketWidth); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment