Subject: random() function documentation

From: Dagfinn Ilmari Mannsåker <[email-masked]>
Date: Mon, 11 Apr 2022 19:38:45 +0100

Hi Hackers,

I just noticed that the since the random() rewrite¹, the documentation's
claim² that it "uses a simple linear congruential algorithm" is no
longer accurate (xoroshiro128** is an xorshift variant, which is a
linear-feedback shift register algorithm).

I don't have a suggestion for the exact wording, since I don't know
whether xoroshiro128** qualifies as "simple", or to what level of
specificity we want to document the algorithm.

- ilmari

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=3804539e48e794781c6145c7f988f5d507418fa8
[2] https://www.postgresql.org/docs/devel/functions-math.html#FUNCTIONS-MATH-RANDOM-TABLE

---

From: Tom Lane <[email-masked]>
Date: Mon, 11 Apr 2022 14:45:19 -0400

> specificity we want to document the algorithm.

How about we just say "uses a linear-feedback shift register algorithm"?
"Simple" is in the eye of the beholder anyway.

			regards, tom lane

---

From: Dagfinn Ilmari Mannsåker <[email-masked]>
Date: Mon, 11 Apr 2022 20:00:26 +0100

> How about we just say "uses a linear-feedback shift register algorithm"?

That works for me.  Nice and simple, and not overly specific.  Should we
perhaps also add a warning that the same seed is not guaranteed to
produce the same sequence across different (major?) versions?

> "Simple" is in the eye of the beholder anyway.

Indeed.

- ilmari