Fun with random
Jun. 28th, 2016 07:29 pmMy colleague Alex_Ignatov@facebook.com found curious behavior of random():
Something like
;-)
postgres=# select (select random() as value ) from generate_series(1,10) as k;
value
-------------------
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
0.715956253930926
(10 rows)Something like
int rnd=5; // This figure is really random. Got it by rolling a die
;-)