lab8

 #include <iostream>

#include <limits>

using namespace std;

void lcg(int s, int a, int c, int m, int n) {

    unsigned int x = s;

    for (int i = 0; i < n; i++) {

        x = (a * x + c) % m;

        cout << x << " ";

    }

    cout << endl;

}

int main() {

    unsigned int s;

    int n;

    cin >> s >> n;

    int a = 1664525, c = 1013904223;

    unsigned int m = UINT_MAX;

    lcg(s, a, c, m, n);

    return 0;

}


Comments

Popular posts from this blog

lab1

lab9