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:


+(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.)

Comments:
Thanks for sharing this informative content.,
Turient is an All-in-one platform for all our teaching needs. If Teaching is your passion ,enabling is ours
Read the Informative blog - 11 Free Teaching Tools for Online Teachers
11 Free Teaching Tools for Online Teachers
Free Teaching Tools

 
Thanks for sharing this informative content.,
Turient is an All-in-one platform for all our teaching needs. If Teaching is your passion ,enabling is ours
Read the Informative blog - 11 Free Teaching Tools for Online Teachers
Turient
Free Teaching Tools for Online Teachers
 

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]