Ivan Sergio Borgonovo wrote:
I don't get the 1366.0 and the 714025.0.
Writing 1366.0 isn't going to use float arithmetic?
Yes, that's on purpose. Now that you mention it, I think that 1366.0
could be an integer instead, but the division by 714025 and
multiplication by 32767 have to b
On Tue, 07 Jul 2009 12:07:48 +0200
"Daniel Verite" wrote:
> Ivan Sergio Borgonovo wrote:
>
> > r2:=l1 # 1366.0*r1+150889)%714025)/714025.0)*32767)::int;
> > -- but what about this? where does it come from?
>
> This function:
> (1366.0*r1+150889)%714025
> implements a known method
Ivan Sergio Borgonovo wrote:
r2:=l1 # 1366.0*r1+150889)%714025)/714025.0)*32767)::int;
-- but what about this? where does it come from?
This function:
(1366.0*r1+150889)%714025
implements a known method to get random numbers. I think it comes from
"Numerical recipes" by Willia
Ivan Sergio Borgonovo wrote:
I need shorter values (because they should be easier to type.
To be sure to modify the function in a sensible way I really would
appreciate some pointer.
Still if it return
What exactly is your desired range of output values?
Best regards,
--
Daniel
Postg
On Sat, 02 May 2009 11:26:28 +0200
"Daniel Verite" wrote:
> Note that it returns a bigint because we don't have unsigned
> integers in PG. If you're OK with getting negative values, the
> return type can be changed to int.
> Otherwise if you need a positive result that fits in 32 bits, it's
> po