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
What are the disadvantages of using grid analysis to help make decisions?
alekssr [168]

Answer:

Grid analysis is best used when a decision needs to consider multiple outcomes and different criteria. The format of this method however, can provide bias to a certain outcome. The process is only as good as the quality of information placed within the grid including the scoring. Once a factor is graded or placed subjectively, objectivity is compromised in this method. Also, this method keeps decision making strictly in a rational manner. But, it is considered unhealthy to be linear in decision making and one-sided. It is best to base decisions from a rational and take emotions into account as well.

7 0
2 years ago
Read 2 more answers
In the early 1800's, a “computer" was not a machine, it was a person who did math
balu736 [363]

Answer:

True

brainly needs more words apparently

7 0
3 years ago
Read 2 more answers
A(n) ________ converts your voice's sound waves into digital signals.
Montano1993 [528]
Analog-to-digital converter chip
8 0
3 years ago
Which of the following can potentially be changed when implementing an interface?
yan [13]

Answer:

c. You cannot change the name, return type, or parameters of a method defined by the interface.

Explanation:

When implementing an interface:

  • The return type of the implementing method should be same as the one defined in the interface.
  • The parameters of the implementing method should be the same as defined in the interface.
  • The name of the method should be the same as that defined in the interface.

So among the given options , option c is the most relevant as it captures all the above conditions.

6 0
3 years ago
WHAT 1 + 1 ???? ???????????????????
antiseptic1488 [7]
The answer to this is 11
5 0
2 years ago
Read 2 more answers
Other questions:
  • major m,ajorrr points helpppppppppppppppppppppppppppi have a question i hit a few buttons and now my computer is saying everythi
    11·2 answers
  • One main advantage of CD-ROMs is that..
    7·1 answer
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • Suppose one hundred stores participated in the
    14·1 answer
  • After a chart has been inserted and formatted, is it possible to change the data range it refers to or to add new rows of data?
    14·1 answer
  • Options to open,save,and print a document are found on which of the following tabs? A.File B.Home C. Design D. Layout
    5·2 answers
  • With respect to computer networks, organizations often install a dedicated telephone system called a ________ to route external
    8·1 answer
  • The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. For ma
    10·1 answer
  • What is the function of a breadcrumb trail in a website?
    13·1 answer
  • (Display characters) Write a method that prints characters using the following header: public static void printChars(char ch1, c
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!