lundi 7 mars 2016

Generate a random number in c without using any header provided functions

I am working on a project, where I am implementing a small kernel, and I came across a problem that requires me to generate a random number. I cannot use any headers, so functions like rand() are out of the question. I am not quite sure how can this be done. I am assuming that I can get a random number by using the values gathered from certain registers, but I have no idea how to do this.

I can actually use the x86.h, and someone told me that I can generate a random number by using the read_cycle_counter() function from x86.h ? Is this a viable option, and how can this be done?




Aucun commentaire:

Enregistrer un commentaire