Hi,
During 3 days I investigate my code and suggest current source is bad
So current code crashes about 70% when I run it. But if I write the following code I'll get about 10% of crashes. And this is much better than previous case:
How to fix this problem?
Thanks
During 3 days I investigate my code and suggest current source is bad
PHP:
- (int)randomWithRange: (NSInteger) min: (NSInteger) max
{
return random() % max + min;
}
. . .
while(YES)
{
int firstValue = [self randomWithRange: 20: 100];
int secondValue = [self randomWithRange: 20: 100];
int resultValue = firstValue + secondValue;
if(resultValue < 100)
{
break;
}
}
PHP:
- (int)randomWithRange: (NSInteger) min: (NSInteger) max
{
return random() % max + min;
}
. . .
while(YES)
{
int firstValue = [self randomWithRange: 1: 9];
int secondValue = [self randomWithRange: 1: 9];
int resultValue = firstValue + secondValue;
if(resultValue < 9)
{
break;
}
}
How to fix this problem?
Thanks