login
Consecutive values produced by the C++ minstd_rand random number generator with the default seed (1).
3

%I #16 Oct 25 2017 17:35:46

%S 48271,182605794,1291394886,1914720637,2078669041,407355683,

%T 1105902161,854716505,564586691,1596680831,192302371,1203428207,

%U 1250328747,1738531149,1271135913,1098894339,1882556969,2136927794,1559527823,2075782095,638022372,914937185,1931656580

%N Consecutive values produced by the C++ minstd_rand random number generator with the default seed (1).

%C This is a linear congruential random number generator with multiplier 48271.

%H Alois P. Heinz, <a href="/A221556/b221556.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Eric M. Schmidt)

%H Stephen K. Park and Keith W. Miller, <a href="http://www.cems.uwe.ac.uk/~irjohnso/coursenotes/ufeen8-15-m/p1192-parkmiller.pdf">Random Number Generators: Good Ones are Hard to Find</a>, Communications of the ACM, Volume 31, Number 10 (October, 1988), pp. 1192-1201.

%H <a href="/index/Ps#PRN">Index entries for sequences related to pseudo-random numbers.</a>

%F a(n) = 48271^n mod (2^31-1).

%p a:= proc(n) option remember; `if`(n=0, 1,

%p irem(48271 *a(n-1), 2147483647))

%p end:

%p seq(a(n), n=1..30); # _Alois P. Heinz_, Oct 25 2017

%t f[n_] := PowerMod[48271, n, 2^31 -1]; Array[f, 23] (* _Robert G. Wilson v_, Nov 10 2014 *)

%o (C++)

%o #include <iostream>

%o #include <random>

%o void A221556(int max)

%o {

%o std::minstd_rand gen;

%o for (int i = 1; i <= max; ++i)

%o std::cout << i << ' ' << gen() << '\n';

%o }

%Y Cf. A096550.

%K nonn

%O 1,1

%A _Eric M. Schmidt_, Jan 19 2013