Guest User

Untitled

a guest
Feb 9th, 2018
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cf = Compile[{},
  2. Block[{part, sum1 = 0., sum2 = 0., n = 0},
  3. Do[
  4. part = RandomReal[1, 10000];
  5. sum1 += Total[part];
  6. sum2 += Total[part^2];
  7. n += 10000;
  8. ,
  9. {100}
  10. ];
  11. {sum1, sum2}/n
  12. ],
  13. {{sum1, _Real, 0}, {sum2, _Real, 0}, {n, _Integer, 0}, {part, _Real,
  14. 1}}
  15. ]
RAW Paste Data