1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
fomenos
1 year ago
7

Question 1

Computers and Technology
1 answer:
Fittoniya [83]1 year ago
8 0

Using the knowledge in computational language in C++ it is possible to write a code that generates and displays 10 random (integer) numbers between 0 and 50.

<h3>Writting the code in C++</h3>

<em>  class SecureRandom : Random</em>

<em>    {</em>

<em>        public static byte[] GetBytes(ulong length)</em>

<em>        {</em>

<em>            RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider();</em>

<em>            byte[] bytes = new byte[length];</em>

<em>            RNG.GetBytes(bytes);</em>

<em>            RNG.Dispose();</em>

<em>            return bytes;</em>

<em>        }</em>

<em>        public SecureRandom() : base(BitConverter.ToInt32(GetBytes(4), 0))</em>

<em>        {</em>

<em />

<em>        }</em>

<em>        public int GetRandomInt(int min, int max)</em>

<em>        {</em>

<em>            int treashold = max - min;</em>

<em>            if(treashold != Math.Abs(treashold))</em>

<em>            {</em>

<em>                throw new ArithmeticException("The minimum value can't exceed the maximum value!");</em>

<em>            }</em>

<em>            if (treashold == 0)</em>

<em>            {</em>

<em>                throw new ArithmeticException("The minimum value can't be the same as the maximum value!");</em>

<em>            }</em>

<em>            return min + (Next() % treashold);</em>

<em>        }</em>

<em>        public static int GetRandomIntStatic(int min, int max)</em>

<em>        {</em>

<em>            int treashold = max - min;</em>

<em>            if (treashold != Math.Abs(treashold))</em>

<em>            {</em>

<em>                throw new ArithmeticException("The minimum value can't exceed the maximum value!");</em>

<em>            }</em>

<em>            if(treashold == 0)</em>

<em>            {</em>

<em>                throw new ArithmeticException("The minimum value can't be the same as the maximum value!");</em>

<em>            }</em>

<em>            return min + (BitConverter.ToInt32(GetBytes(4), 0) % treashold);</em>

<em>        }</em>

<em>    }</em>

See more about C++ code at brainly.com/question/19705654

#SPJ1

You might be interested in
Serveral cheetas are growling at each other while hunting for animals.for which need are they competing?
SVEN [57.7K]

Answer:

prey

Explanation:

5 0
3 years ago
Java: which expression is evaluated first
nignag [31]

Answer:c ll d  

Explanation:

cus they are inside ()--parantheses

5 0
2 years ago
How do you find a single number or name you want in a
Tamiku [17]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

You can find a single number or name in a large worksheet containing thousands of numbers and names using the find and replacement feature in excel.

You can use Ctrl+F keyboard shortcut for finding and replacing features. When you press Ctrl+F, a dialog will get open, using this dialog, you can find the required number or name while entering in the search text box. Then, click on the Find button, if the worksheet matches the result, give you the matched result in the yellow highlighted color.

Also, you can use Ctrl+F to replace a name or number with some other name or number.

Alternatively, you can do this using the home tab, then find the option find and select under the editing group of commands.

8 0
3 years ago
The language C was originally developed by​
nataly862011 [7]

Answer:

Dennis Ritchie

C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to make utilities running on Unix

3 0
3 years ago
Read 2 more answers
Ima go to sleep but I ask a favor can u guys go on eBay Amazon and find the cheapest pre bilt that is actually good
katrin2010 [14]

Explanation:

what do specifically want to buy??

8 0
2 years ago
Read 2 more answers
Other questions:
  • HELP ME PLZZ FFFAAASSSTTTT
    8·2 answers
  • Easy question how the internet has impacted y’all life
    13·1 answer
  • Which of these can be considered data?<br> A:facts<br> B:information<br> C:belief<br> D:all of these
    9·1 answer
  • In _____ conversion of the implementation phase of the systems development life cycle (SDLC), the old and new systems run simult
    9·1 answer
  • How can i complain a rude comment
    7·1 answer
  • Primary technology skills are skills that are necessary for success in online education
    9·2 answers
  • What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:
    15·1 answer
  • Ayuda pliz es para ya!!!!!<br> nesesito un codigo html que me muestre este texto
    8·1 answer
  • 2.2 Write an interactive C# program that asks the user to input an integer number. The program checks whether the number entered
    10·1 answer
  • Network connections implemented with the use of a cable modem take advantage of?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!