I'd really love to use Mersenne Twister as alternative to arc4random. So to make my life not too hard it would be great if there was an implementation of this in Objective-C which I can simply add to my project.
So I searched and found this: Mersenne Twister in Objective-C
Unfortunately, the author writes in the p开发者_开发技巧ost:
I am not exactely sure if the implementation is 100% correct with respect to the "-0.5" that I added.
I can't verify if it's correct or not, but of course it would be stupid to use a third party implementation rather than the original if the "translator" isn't sure about it's correctness.
Maybe I should just go with the C implementation and write an Objective-C interface to access the functions? Did anyone else do exactly this?
Objective C is a pure superset of ANSI C. So, if you have a C implementation that fits your requirements, just use that. You could wrap the C function in an Obj C method if needed for syntactical reasons.
精彩评论