Question: Need this problem solved in c++ Already tried the small part of code in the last pic. Doesnt seem to work. And dont understand where

 Need this problem solved in c++ Already tried the small part
of code in the last pic. Doesnt seem to work. And dont
understand where in the main code it goes. Prog 2 (extra credit):
Bitmasking, random numbers Attached to this assignment is a C program I've
Need this problem solved in c++ Already tried the small part of code in the last pic. Doesnt seem to work. And dont understand where in the main code it goes.

Prog 2 (extra credit): Bitmasking, random numbers Attached to this assignment is a C program I've written to print 20 random 64 bit patterns followed by 20 random 32 bit patterns. However, it doesn't work consistently from machine to machine and compiler to compiler (but don't worry... you'llfix it). That's because the C rand0 function, while often returning 31 random bits, is only guaranteed by the C standard to produce 15 random bits. To deal with this, I've created a function called "rand_bits" that is supposed to use the C standard rand) to return a 64 bit pattern with all zeros except for the lowest bits, which are randomized. The number of low randomized bits is provided by the only parameter to the function. For example, if the function is called with 24 as the argument value, it might return a 64 bit pattern, such as: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000_1101 0110_0101 1110_0111 1100 Currently, this function is stubbed and may show more than 15 random bits coming from the rand) function, but this is by NO means guaranteed, so we'd better assume rand retuns only 15 random bits. You are to modify this program by editing the rand_bits(0) function to perform as described. DO NOT MODIFY ANY OTHER CODE IN THE PROGRAM

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!