[sv-ec] EXT 8 - randcase


Subject: [sv-ec] EXT 8 - randcase
From: Ryan, Ray (Ray_Ryan@mentorg.com)
Date: Sun Aug 31 2003 - 17:28:06 PDT


In the definition, I suggest that:
a) The sum of all weights be restricted to less than (2**32 - 1).
   [This should be true for most all uses and might allow
   for a more efficient implementation.] If the sum of all
   weights exceeds this value, then no branch is taked and
   a warning may be issues.

b) The action for negative weights should be defined. Suggest:
     If a branch specifies a zero (or negative) weight then that
     branch is not taken. If all randcase items specify zero
     (or negative) weights then no branch is taken and a warning may be
issued.

In the last discussion, there was some discussion about stability.
If consistent implementation is desired, here is a possible description of
the behavior:
1) The sum of all weights (SUM) is computed (negative values contribute a
zero weight).
2) If SUM is zero or exceeds (2*32-1), no branch is taken. Otherwise
3) $urandom_range(SUM,0) is used to generate a random number.
4a) If the randomn number is less than the weight of the first branch, then
    that branch is taken. Otherwise the random number is reduced by the
    branch weight.
4b) 4a is repeated for each branch of the randcase statement (following the
order
    the branches occur in the statement).

- Ray



This archive was generated by hypermail 2b28 : Sun Aug 31 2003 - 17:30:05 PDT