Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Credit management.

Answered: 1 week ago