Hi everyone . I am a newbie in programming , so i would be very grateful if you could help me . I have to implement the Blum Blum Shub in C or C++ using the stdlib.h and time.h libraries . Can anyone help me with this ?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
No idea, because we do not have the instructions that your teacher gave you. If you read the documentation for the random and time functions (time, _time32, _time64 | Microsoft Docs[^]) you should be able to decide how they can help you.
Here's the full indications that i have :
Purpose: to develop a function that generates random numbers from
a given range.
Elaboration of the module for generating random numbers
C or C++ compiler
stdlib.h and time.h libraries
Algorithm Blum Blum Shub
I have to implement the Blum Blum Shub in C or C++...
More importantly, can you do it with pencil and paper? If the answer is no, then: 1) you are going to be hard pressed to implement it in code, and 2) you should work on it until you can produce results on paper. Don't let computer code take the place of the basic understanding of algorithms.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
/*BLUM BLUM SHUB*/
const int p = 30000000091;
const int q = 40000000003;
int N ;
const unsigned long long int s = 1200000003730000000273;
unsigned int i,M,x[N];
printf(" x[%d] = %d\n",i,x[i]);
I have some issues with it , first it's that i need to add from console the biggest number D and i dont know how to put it in as now it's generating numbers without upper limit . Also can anyone tell me how to fix the code as it generates the same numbers at some intervals , if you have other remarks on how to make it better tell me please . Thanks
Last Visit: 31-Dec-99 19:00 Last Update: 27-Feb-21 21:08