シードを固定した乱数
Posted feedbacks - Objective-C
ガバレッジをあげる為と自分の勉強の為に投稿いたしました
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #import <Foundation/Foundation.h>
#define SEED srand(64)
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int r;
SEED;
for (int i = 0; i < 10; i++) {
r = rand();
}
NSLog(@"%d",r);
[pool drain];
return 0;
}
|

ところてん
#9451()
Rating1/1=1.00
[ reply ]