[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (random t) always returns the same number under HP-UX 10.20
From: |
Eli Zaretskii |
Subject: |
Re: (random t) always returns the same number under HP-UX 10.20 |
Date: |
Tue, 4 Dec 2001 09:59:23 +0200 (IST) |
On 3 Dec 2001, Klaus Zeitler wrote:
> >> (random t) always returns the same number when I call it
> >> right after starting emacs -q. According to the docu this call should
> set a
> >> random seed from the current time and pid.
> Eli>
> Eli> What happens if you invoke (random t) and then (random 100000)
> Eli> repeatedly?
> 3 times (random t) gives always this sequence of numbers:
> 46095250 -74119605 -46522877 -114711201
You are not supposed to call (random t) more than once per a random
sequence. (random t) simply calls `srandom' (or a similar function),
which seeds the RNG. The real sequence comes from the subsequent
calls to `random' whose argument is anything _but_ t.
> 3 times (random 100000)
> 17174 72397 82679 57274
>
> alternating (random t) and (random 100000) 2 times gives:
> 46095250 72397 -46522877 57274
Could you please look at src/s/hpux10.h and src/sysdep.c, and see what
macros related to random are defined in your build? (Search for
"random" case-insensitively in these two files.)
Also, what are the prototypes of `srandom', `random', `srand48', and
`lrand48' on your HP-UX machine (should be in stdlib.h)? Perhaps by
comparing the prototypes with the above-mentioned Emacs files, you
could find some discrepancy that explains the problems?
Alternatively, if you could give me an SSH login on that machine, I
will try to investigate. SSH public key is available upon request.