Computer Science, asked by sijojoseph0087, 3 months ago

which is the cpp code for generating an array of random numbers ?​

Answers

Answered by Anonymous
9

Answer:

You can create a random number generator in C++ by using the rand() and srand() functions that come with the standard library of C++. Such a generator can have the starting number (the seed) and the maximum value.

Answered by PredictorPrajwal
20

Answer:

The random number generator in C++ is a program that generates seemingly random numbers. You should learn how to create this feature if you need to make something in your program or website random. For instance, you might want your users to roll dice and receive rewards according to the number they get.

Contents

1. Using the random number generator to choose prizes for users

2. Where are random numbers used?

3. The main function for a random number generation

4. Making the random numbers different after every execution

5. Generating numbers within different ranges

5.1. Random numbers between 0 and 1

5.2. Random numbers between 1 and 10

5.3. Random numbers between 1 and 100

Using the random number generator to choose prizes for users

You can easily imitate dice rolling by using a random number generator.

Let's say you are organizing a prize giveaway for your users. However, the prizes need to be selected randomly while also keeping users entertained. A random dice roll is a solid option.

The following example of the C++ code shows how the roll dice feature lets you randomly pick prizes for your users (according to the number rolled). For this aim, you should also use the switch statement to present different outcomes

Explanation:

I hope this answer is helpful for you please mark this answer as brainliest answer

Similar questions