You need to use your compiler's debugger to step through that code and find out what is causing the problem because it isn't apparent from what you posted.
I can tell you that lines 6 and 7 will produce very very small numbers. The purpose of dividing the return value of rand() by RAND_MAX (which is a huge number) isn't apparent.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
What compiler are you using ? The program is probably indexing beyond the bounds of arrays, or the index values are crap. Can't really help much without the whole program.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343