私はこのコードを使用していますが、 'length'の値は '50'です。厄介なarc4randomの結果
2012-01-02 21:10:50.794 Kipos[28833:207] Creature Move X:4294967296.000000, Y:4294967296.000000
2012-01-02 21:10:50.896 Kipos[28833:207] Creature Move X:4294967296.000000, Y:12.000000
は何が起こっている:
newX = (arc4random()%(lenght+1)) - (lenght/2);
newY = (arc4random()%(lenght+1)) - (lenght/2);
NSLog(@"Creature Move X:%f, Y:%f", newX, newY);
しかし、私はのようなものを取得し、デバッガで
?newX
とnewY
フロートである:
float newX;
float newY;
非常に奇妙な...「lenght」(typo btw)のタイプは何ですか?また、このログと同時にNSLogできますか? – joerick
長さ(typo * facepalm *)はintです。すでに解決済み。しかし、ありがとう! –