Homerun?
Problem 7What
can you infer about the rand() function after looking at the code
and its output?
#define ITER 10000
#define SEED 0x12345678
test()
{
int i;
int counts[4]={0,0,0,0};
srand(SEED);
for (i=0; i4; i++)
{
printf("%d bin probability =
%f\n", i, counts[0]/(float)ITER;
}
}
After running the code many times with
different values for
ITER and SEED, you always get the
same output:
0 bin probability = 0.25000
1 bin probability = 0.25000
2 bin probability = 0.25000
3 bin probability = 0.25000
ANSWER

Problem 8You work
for a robotics company and, for a demo project, you are helping design
a robotic skeet shooter. All that remains is developing a tracking
algorithm. You are receiving a video image with sufficient frame speed
to track the target. You need an algorithm to help guess where the
target will be in successive video frames. What would you suggest?
ANSWER 
8--99
|