[LUGOS-PROG] Bash si sladak
Miha Tomšič
miha.tomsic at guest.arnes.si
Thu Mar 21 13:19:07 CET 2002
Hojla!
On Tue, 19 Mar 2002, Borut Mrak wrote:
> /* Returns a pseudo-random number between 0 and 32767. */
> static int
> brand ()
> {
> rseed = rseed * 1103515245 + 12345;
> return ((unsigned int)((rseed >> 16) & 32767)); /* was % 32768 */
> }
>
> /* Set the random number generator seed to SEED. */
> static void
> sbrand (seed)
> unsigned long seed;
> {
> rseed = seed;
> last_random_value = 0;
> }
Malo sem pobrskal po debianovih sourcih in dejansko so tele zadeve
popatchane:
/* Returns a pseudo-random number between 0 and 32767. */
static int
brand ()
{
#if defined(HAVE_RANDOM)
return (unsigned int) (labs(random()) & 32767);
#else
rseed = rseed * 1103515245 + 12345;
return ((unsigned int)((rseed >> 16) & 32767)); /* was % 32768 */
#endif
}
/* Set the random number generator seed to SEED. */
static void
sbrand (seed)
unsigned long seed;
{
#if defined(HAVE_SRANDOM)
srandom(seed);
#else
rseed = seed;
last_random_value = 0;
#endif
}
---
Seveda debian uporablja random in srandom in ga zato tudi bash veselo
uporablja. Tako, da težava verjetno izvira od tam.
A lahko še kdo s SuSEjem pogleda, kakšne source uporabljajo in kaj jim
piše v variables.c.
Miha...
- Miha Tomšič --- C. na postajo 55 -- SI-1351 Brezovica pri Lj. --- SLOVENIA -
More information about the lugos-prog
mailing list