/////////////////////////////////////////////////////////////////////////// // Homework:1 // Exercise:3 // // Summary: a (very) little bit on conversion // // Goals: // // 1 - Find out the calling convention (argument type, return type) // on rand() using the command "man rand" on pads1 (VMS users can // get the same info by typing "help cc run-time rand" // // 2 - regardless of the specific upper limit either help page above quotes, // always refer to RAND_MAX in your code, rather than the quoted number (which // usually depends on the range of int's on that particular machine). Find out // what RAND_MAX is by printing in the main() function // // 3 - write a function "double my_rand(void)" which returns a ---double--- in the // range [0,1] (close interval is indicated). // Use the rand() function, RAND_MAX, and the automatic or explicit conversion // (int --> double). Call this function a few times from main() // // 4 - (very optional) If you feel like it, have a loop call my_rand() // several thousand times (output is not necessary for this step!!), // and calculate the mean and standard deviation (and any // other quantities you think might check the "randomness" of your // random number generator (this is actually a non-trivial question, but // just see what you come up with). // /////////////////////////////////////////////////////////////////////////// #include // for i/o library #include // to get access to rand() .. but on VMS (?) the help page says to // include instead. Let me know which one is correct (the // correct one should include the declaration for rand() as well // as the definition of RANDMAX. int main() // I'm not using argc, argv, so I'm using the simpler version of main() { // you'll insert your code in here somewhere return 0; }