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
According to Alisa Miller, why does news focus so heavily on celebrities?
kirill115 [55]

Answer:

one, because the consumers of news are no longer interested in worlwide events, but rather on events that are happening close to them, and in a form affect them directly, and second, because it is cheaper to cover gossip, and it generates more profitability for media broadcasters, than speaking about events that have no impact on people´s interests.

3 0
3 years ago
If you have a long title and need it to span several cells, you can use what?
Marat540 [252]
I believe this is Insert Controls
5 0
3 years ago
True or false As the contents and topics of new magazines change year-to-year, you can see various trends and movements across s
Tamiku [17]

the short answer is true.

The long answer is that magazines can help shape and invent new trends.  like they have time and time again in the past.

Hope this helps

-scav

8 0
3 years ago
Gn to be printed at a commercial printer. Which main ink type's exact color appearance is determined by the printer and requires
satela [25.4K]
Idek frl tho maybe go with your gut
5 0
3 years ago
A game design company develops a game in which players run a grocery store and need to keep tabs on the dollar amount of goods s
sdas [7]
I do believe it is Inventory management but I can never tell if it is the right answer. so my regards if it the wrong answer.

6 0
3 years ago
Other questions:
  • A collision between gas atoms and electrons raises the energy levels of oxygen and nitrogen in the _________.
    8·2 answers
  • On a Linux system, which command allows you to modify settings used by the built-in packet filtering firewall?
    15·1 answer
  • im in honors comupter science and one of my questions is evaluate 18% 7 does anyone know how to answer that
    6·1 answer
  • Which page feature is used in long documents to assist readers in quickly finding information in the document without having to
    11·2 answers
  • What is processing requirement in computer?
    11·1 answer
  • Complete the implementation of the following methods:__init__hasNext()next()getFirstToken()getNextToken()nextChar()skipWhiteSpac
    11·1 answer
  • Technology has had
    10·1 answer
  • In which situation is coauthoring of presentations primarily utilized?
    13·2 answers
  • Where did the name "QWERTY" come from?​
    9·1 answer
  • What are the 49 questions for creat and edit Excel assessment​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!