in reply to for loop less than test ill behaved...

The rand function returns a fractional number, but you just print the integer part with the %d format. In the last iteration $k is still less than $data_length which you'll see easily if you print using the %fformat, or just use print instead of printf.

  • Comment on Re: for loop less than test ill behaved...