Puzzle DA7


Fill an array with random doubles in the range Low <= d < High

[E-4] Write a function that fills an array with randomly selected double precision floats in a specified range. Notice that the range does not include the high value. Here is sample output of a program that tests the function, using a range of 0.0 to 10.0. Printing the array is done with the solution of the next puzzle.

  0.0125   5.6357   1.9330   8.0872   5.8499
  4.7986   3.5028   8.9594   8.2281   7.4658
  1.7410   8.5892   7.1048   5.1352   3.0399
  0.1498   0.9140   3.6444   1.4731   1.6589
  9.8849   4.4568   1.1908   0.0467   0.0891
  3.7787   5.3165   5.7117   6.0175   6.0715
  1.6623   6.6302   4.5078   3.5211   0.5704
  6.0767   7.8329   8.0258   5.1987   3.0194
  8.7595   7.2665   9.5587   9.2569   5.3934
  1.4233   4.6207   2.3532   8.6221   2.0959
  7.7963   8.4363   9.9677   9.9966   6.1148
  3.9243   2.6620   2.9727   8.4012   0.2374
  3.7585   0.9262   6.7719   0.5621   0.0879
  9.1876   2.7588   2.7289   5.8789   6.9116
  8.3759   7.2647   4.8492   2.0535   7.4371
  4.6844   4.5795   9.4913   7.4442   1.0828
  5.9903   3.8522   7.3499   6.0895   5.7239
  3.6133   1.5155   2.2510   4.2514   8.0286
  5.1709   9.8996   7.5153   3.4555   1.6898
  6.5729   4.9188   0.6354   6.9974   5.0479
Work on puzzles DA07 and DA08 together. You could do DA08 first, but it would be tedious to test without a function that fills an array.



Previous Page        Answer         Next Page         Home