swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Random Seed question


From: Sven Thommesen
Subject: Re: Random Seed question
Date: Wed, 2 Feb 2000 13:01:51 -0600 (CST)


On 2 Feb 2000, Marcus G. Daniels wrote:

> >>>>> "ST" == Sven N Thommesen <address@hidden> writes:
> 
> ST> (b) You may object that java
> ST> doesn't provide unsigned integers, only signed ones. I am assured
> ST> by Marcus that signed integers in java are mapped in an obvious
> ST> one-to-one fashion to unsigned integers in objC. So in java you
> ST> should be able to use any non-zero integer value as a seed.
> 
> Nonetheless, even though the underlying feature is unsigned and the
> mapping understood, the available interface is signed, I suggest using
> the subset of the range: 0 < x <= 2147483647.
>

For setting seeds, this has the effect of reducing by a factor of 2 the 
number of possible seeds, and hence of possible starting configurations 
for the generator(s). This does not seem that desirable. You just have to 
be careful to record what seeds were used.

Full range generators will of course continue to provide output in the range 
[0,2^32-1], which on the java side translates to [-2^31,+2^31-1]. 31-bit 
generators like PMMLCG will not generate numbers larger than 2^31, so on 
the java side no negative numbers will be seen.

The unsigned to signed mapping is:

unsigned                signed
--------                ------
2^32-1                  -1
2^31                    -2^31
2^31-1                  2^31-1
0                       0

As can be seen, there's a discontinuity there ...

Cheers,
Sven


 >                   
==================================
>    Swarm-Support is for discussion of the technical details of the day
>    to day usage of Swarm.  For list administration needs (esp.
>    [un]subscribing), please send a message to <address@hidden>
>    with "help" in the body of the message.
> 
> 

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]