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
Svetlanka [38]
4 years ago
11

in c++, what happends when i add 1 to the RAND_MAX then take rand() deivded by (RAND_MAX+1)?if my purpose is to take out a rando

m number within 0=< and =<1?
Computers and Technology
1 answer:
noname [10]4 years ago
3 0

Explanation:

rand() function is used to generate random integers between the range 0 to RAND_MAX.So if we divide the the rand() function by RAND_MAX the value returned will be 0.

You cannot do RAND_MAX + 1 the compiler will give error integer overflown.

To generate an integer with a range.You have to do like this:

srand(time(0));

int a=-1*(rand() % (0 - 5245621) +1);

cout <<a;

This piece of code will return an integer within the range 0 to -5245622.

You might be interested in
It is the ornamentation of textiles and other material with needle work
vesna_86 [32]
A! Embroidery is the ornamentation of textiles using needle work

6 0
3 years ago
Sniffer turns the NIC of a system to the promiscuous mode so that it listens to all the data transmitted on its segment. It can
Mamont248 [21]

Answer:

The right answer will be "Sniffing through a hub".

Explanation:

  • Packet sniffer seems to be a device that listens for transmitted data on what seems like a channel. Sniffing enables the detection of data by individual people as it has been transferred throughout a cable.
  • Appropriate nodes are using this methodology to make a diagnosis of connection issues, or even just harmful programs to obtain confidential information, like authentication and encryption.
6 0
3 years ago
Given four inputs: a, b, c &amp; d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsi
Amiraneli [1.4K]

Answer:

z = a.c' + a.b.d' + b.c'.d'

Explanation:

The truth table for this question is provided in the attachment to this question.

N.B - a' = not a!

The rows with output of 1 come from the following relations: 01 > 00, 10 > 00, 10 > 01, 11 > 00, 11 > 01, 11 > 10

This means that the Boolean expression is a sum of all the rows with output of 1.

z = a'bc'd' + ab'c'd' + ab'c'd + abc'd' + abc'd + abcd'

On simplification,

z = bc'd' + ab'c' + ac'd' + ac'd + abc' + abd'

z = ac' + abd' + bc'd'

Hope this helps!

6 0
4 years ago
Which of the following must be true in order for an object to stay in place?
Allushta [10]
The forces must be balanced.

This is in accordance to Newton's first law of motion, which states that an object at rest will remain at rest and an object in motion will remain in motion unless acted upon by an unbalanced force.
An unbalanced force is also known as a resultant force.
4 0
3 years ago
To change the print orientation from portrait to landscape, tap or click the ____ button on the print preview tab.
lianna [129]
<span>In certain instances, it makes sense to print documents in landscape orientation. Some examples include spreadsheets and tables, where the content within the document is wider than it is longer. If you print in portrait mode, it would cut off parts of the table or spreadsheet. In this case, you'll want to change the print settings to landscape. To change it to landscape, simply click the "landscape" button on the print preview tab.</span>
4 0
3 years ago
Other questions:
  • A company has decided to re-introduce a retro-radio by reproducing a product that was manufactured in the 1940s. The company has
    5·1 answer
  • When an attacker uses bluetooth to copy e-mails, contact lists, or other files on the device, it is called?
    12·1 answer
  • this device can be used to type documents,send email,browse the internet,handle spreadsheets,do presentations,play games,and mor
    14·1 answer
  • Write a C class, Flower, that has three member variables of type string, int, and float, which respectively represent the name o
    12·1 answer
  • Accessing disk is much slower than accessing memory. As a result, many file systems have been designed with various optimization
    7·1 answer
  • Take a list of numbers that range in value from 0 to 9 and output how many occurrences of each number exist.
    12·1 answer
  • Which of the following components converts AC to DC?
    5·1 answer
  • Jane wants to type a math assignment involving percentages she wants to insert the percent symbol after typing a number which ke
    10·1 answer
  • 2. Cryptography relies on open standards - a protocol or standard that is publicly available. Why are open standards necessary
    5·1 answer
  • What type of attack occurs when the threat actor snoops and intercepts the digital data transmitted by the computer and resends
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!