There are many alternatives to
that have a richer, more flexible, type-safe interface, e.g.,
If you decide you want more specific sampling, e.g., from a specific distribution from a specified range, consider
Note's about your above code sample:
's rather than c-array's for type-safety when accessing/storing data.
2. Consider alternatives to
that provide specific types that accomplish the same results.
3. Avoid nested for-loops utilising counters of the same name (here, its a typo however).
4. Consider manipulating the output stream once outside the loop then resetting it at the end (if desired).
5. Be explicit with namespace scope (i.e.,
using namespace std;...cout << ...
6. Post-incrementation of counters brings you nothing here, just a needless copy. Use the pre-increment op.