Click here to Skip to main content
15,922,155 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: std::cout inside of object Pin
Randor 12-Oct-20 6:20
professional Randor 12-Oct-20 6:20 
GeneralRe: std::cout inside of object Pin
Victor Nijegorodov12-Oct-20 8:22
Victor Nijegorodov12-Oct-20 8:22 
QuestionInsert or embed File Dialog in a CPropertyPage Pin
Maximilien6-Oct-20 10:30
Maximilien6-Oct-20 10:30 
AnswerRe: Insert or embed File Dialog in a CPropertyPage Pin
Victor Nijegorodov6-Oct-20 21:12
Victor Nijegorodov6-Oct-20 21:12 
QuestionBlum Blum Shub Pin
Member 149564755-Oct-20 8:12
Member 149564755-Oct-20 8:12 
AnswerRe: Blum Blum Shub Pin
Victor Nijegorodov5-Oct-20 8:18
Victor Nijegorodov5-Oct-20 8:18 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 8:26
Member 149564755-Oct-20 8:26 
GeneralRe: Blum Blum Shub Pin
Victor Nijegorodov5-Oct-20 8:59
Victor Nijegorodov5-Oct-20 8:59 
AnswerRe: Blum Blum Shub Pin
jeron15-Oct-20 8:27
jeron15-Oct-20 8:27 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 8:31
Member 149564755-Oct-20 8:31 
AnswerRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 8:48
mveRichard MacCutchan5-Oct-20 8:48 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 8:57
Member 149564755-Oct-20 8:57 
GeneralRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 9:02
mveRichard MacCutchan5-Oct-20 9:02 
GeneralRe: Blum Blum Shub Pin
Member 149564755-Oct-20 9:08
Member 149564755-Oct-20 9:08 
GeneralRe: Blum Blum Shub Pin
Richard MacCutchan5-Oct-20 9:23
mveRichard MacCutchan5-Oct-20 9:23 
AnswerRe: Blum Blum Shub Pin
ZurdoDev5-Oct-20 10:15
professionalZurdoDev5-Oct-20 10:15 
AnswerRe: Blum Blum Shub Pin
David Crow6-Oct-20 2:39
David Crow6-Oct-20 2:39 
GeneralRe: Blum Blum Shub Pin
Member 149564756-Oct-20 10:32
Member 149564756-Oct-20 10:32 
GeneralRe: Blum Blum Shub Pin
Richard Andrew x646-Oct-20 10:45
professionalRichard Andrew x646-Oct-20 10:45 
SuggestionRe: Blum Blum Shub Pin
David Crow6-Oct-20 16:05
David Crow6-Oct-20 16:05 
GeneralRe: Blum Blum Shub Pin
Member 149564757-Oct-20 7:13
Member 149564757-Oct-20 7:13 
AnswerRe: Blum Blum Shub Pin
David Crow7-Oct-20 7:31
David Crow7-Oct-20 7:31 
GeneralRe: Blum Blum Shub Pin
Member 149564757-Oct-20 7:39
Member 149564757-Oct-20 7:39 
GeneralRe: Blum Blum Shub Pin
David Crow7-Oct-20 7:55
David Crow7-Oct-20 7:55 
AnswerRe: Blum Blum Shub Pin
Member 149564758-Oct-20 1:36
Member 149564758-Oct-20 1:36 
Okay , so this is the final code that i have at the moment
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*BLUM BLUM SHUB*/
int main ()
{

const int p = 347;
const int q = 351;
const unsigned long long int s = 12373273;
int N ;
printf("Introdu numarul de cifre aleatorii:");
scanf("%i", &N);
unsigned int i,M,x[N];
srand(time(NULL));

M=p*q;
i=0;
x[0]=s;
FILE *fp; //txt code
fp = fopen("file.txt", "w"); //txt code
for(i=1;i<=N;i++){
x[i]=rand()*(x[i-1]*x[i-1])%M;
}
for(i=1;i<=N;i++){
printf("%d\t",x[i]);
fprintf(fp, "%d ",x[i]); //txt code

}
system("PAUSE");
fclose(fp);//txt code

return 0;
}
It's working but i have one issue that i can't still solve , i need to put a maximal limit of the generated numbers at input , can anyone give me a clue how i can set x[i] a limit? I only found how to put a limit at rand but when it multiplies with function of BBS it exceeds the limit

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.