Monday, August 10, 2009
down in the metal
I just wanted to say that I didn't think I would ever write low-level C code again. And yet, here I am:
(It's just a utility function to help populate a map with an assortment of randomly distributed pushpins, for test purposes. But still. Sheesh.)
+(NSNumber *) getRandomDoubleMin:(double)min max:(double)max {
srandomdev();
int nRange = (int) max-min;
int nRand = random() % nRange;
double dRand = (double) nRand;
dRand = dRand+min;
int nRand2 = random() %10000;
double dRand2 = (double)nRand2;
dRand2=dRand2/10000;
dRand=dRand+dRand2;
return [NSNumber numberWithDouble:dRand];
}
(It's just a utility function to help populate a map with an assortment of randomly distributed pushpins, for test purposes. But still. Sheesh.)
Subscribe to Posts [Atom]
Post a Comment