Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to simulate caching algorithms using a text file filled with random

ID: 3569587 • Letter: I

Question

I'm trying to simulate caching algorithms using a text file filled with random numbers. I need somone to make a c program that generates random numbers in a realistic manner as one would often see if they were actually doing the caching algorithm on real page numbers. This means that the program must take into account locality and other variables like that. The program must generate random numbers within a range of 0 to 10,000 and must generate a total of 1,000,000 numbers. One possibility is to break down the 1,000,000 numbers into sections and provide each specified section a range within the 10,000 numbers. Please try to do this if you can. Also in order to receive points the program must compile and run completely fine on a mac. It must also generate the text file on its own and have a clear explanation on the inner workings of the function.

You May Not Use The Header File conio.h!

Explanation / Answer

It is possible to collect random data on a computer. SSL, SSH and VPNs would not be secure if you couldn't.

The way software random number generator work is there is a pool of random data that is gathered from many different places, such as clock drift, interrupt timings, etc.

The trick to these schemes is in correctly estimating the entropy (the posh name for the randomness). It doesn't matter whether the source is bias, as long as you estimate the entropy correctly.

To illustrate this, the chance of me hitting the letter e in this comment is much higher than that of z , so if I were to use key interrupts as a source of entropy it would be bias - but there is still some randomness to be had in that input. You can't predict exactly which sequence of letters will come next in this paragraph. You can extract entropy from this uncertainty and use it part of a random byte.

Good quality real-random generators like Yarrow have quite sophisticated entropy estimation built in to them and will only emit as many bytes as it can reliably say it has in its "randomness pool."