{"push_id":1878815373,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"87fdb0143ba86caf298565d8a1756f5d8199134a","before":"ca85b1d092dc628908b40a3993afeb7d8e7a721a","commits":[{"sha":"87fdb0143ba86caf298565d8a1756f5d8199134a","author":{"name":"ardonik","email":"e4eb9dd0dd495baf320f3a881346a46595ad4b1b@ardonik.org"},"message":"Committing my solution to the first ESHS summer robotics exercise.\n\nThe problem statement is:\n\n\"Write a program that asks the user for the number of dice to roll, then have\nit roll that many dice and output the sum.\"\n\nI did this using idiomatic modern C++ constructs:\n\n- I generate cryptographically secure random numbers using the C++11 <random> header.\n- The program is robust (as far as I can tell) to bad input.\n- I used some of C++'s functional (well, functor-related) algorithms:\n  * std::accumulate to generate the sum,\n  * std::generate to populate the rolls array, and\n  * std::copy to copy the integers, one at a time, into an ostream_iterator in\n    order to print the addition formula at the end.\n- Note the use of bind() to turn a unary function (\"distribution(generator)\")\n  into a nullary function (\"rollOneDie()\").\n\nIf the program has any bug at all, it's that it dynamically allocates memory\non the heap in order to store the dice rolls in a container so I can use the\naforementioned fancy functions on it.  So the user can quite easily crash the\nprogram by giving it a stupidly large number of dice to roll.  The naive\nlooping implementation does not have that problem.\n\nAlso added a gitignore because seeing the backup file in the git status\nannoyed me.","distinct":true,"url":"https://api.github.com/repos/uakotaobi/miscellany/commits/87fdb0143ba86caf298565d8a1756f5d8199134a"}]}
{"actor":{"display_login":"uakotaobi"}}