Question: Randomness is a hard challenge for computers. Computers are build to be generally deterministic (they behave the same way from the same initial state). This

Randomness is a hard challenge for computers. Computers are build to be generally deterministic (they behave the same way from the same initial state). This is good for us programmers because it means if we write good code, it should always work the same way (hopefully correctly). However, it is often useful for computers to generate randomness for simulations, models, or generally when you want some unpredictability. The way we generally do this is by writing a function that takes a "seed" number and uses that seed to generate a long series of pseudo-random (appearing random) numbers. But if you supply the same seed, you'll get the same numbers out again.

For this problem, you'll need to use the library from the STL, specifically the mt199937 generator and the uniform_int_distribution class.

Write code in c++, that reads in a seed from stdin (as a long value), seeds the std::mt199937 and uses the generator to generate 10 longs between 0 and 25 (inclusive). Then use these 10 numbers and convert them to lower case letters and output a line with the random "word" to stdout.

Starter Code:

#include  using std::cout; using std::endl; using std::cin; #include  using std::mt19937; using std::uniform_int_distribution; int main() { } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!