On Jan 20, 7:28 am, Stephane CHAZELAS
wrote:
> 2010-01-12 22:07:31 -0500, Chet Ramey:
>
>
>
> > On 1/12/10 5:16 AM, Stephane CHAZELAS wrote:
> > > 2010-01-11, 17:42(-05), Chet Ramey:
> > Think of it as
>
> > x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> > y = dice[x]
> > dice[RANDOM%6+1
2010-01-12 22:07:31 -0500, Chet Ramey:
> On 1/12/10 5:16 AM, Stephane CHAZELAS wrote:
> > 2010-01-11, 17:42(-05), Chet Ramey:
> Think of it as
>
> x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> y = dice[x]
> dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
> return y
> >>> [...]
> >>>
> >>
On 1/12/10 5:16 AM, Stephane CHAZELAS wrote:
> 2010-01-11, 17:42(-05), Chet Ramey:
Think of it as
x = $(( RANDOM%6+1 + RANDOM%6+1 ))
y = dice[x]
dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
return y
>>> [...]
>>>
>>> I would still consider that a bug.
>>
>> OK. But everyone
2010-01-11, 17:42(-05), Chet Ramey:
>> > Think of it as
>> >
>> > x = $(( RANDOM%6+1 + RANDOM%6+1 ))
>> > y = dice[x]
>> > dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
>> > return y
>> [...]
>>
>> I would still consider that a bug.
>
> OK. But everyone does it the same way.
Except for pdksh, mksh, posh
On Jan 11, 3:53 pm, Stephane CHAZELAS
wrote:
> 2010-01-11, 15:59(-05), Chet Ramey:
> [...]> Think of it as
>
> > x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> > y = dice[x]
> > dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
> > return y
>
> [...]
>
> I would still consider that a bug.
>
> I don't think anyone would
> > Think of it as
> >
> > x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> > y = dice[x]
> > dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
> > return y
> [...]
>
> I would still consider that a bug.
OK. But everyone does it the same way.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
2010-01-11, 15:59(-05), Chet Ramey:
[...]
> Think of it as
>
> x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> y = dice[x]
> dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
> return y
[...]
I would still consider that a bug.
I don't think anyone would expect x to be incremented by 2 in a[++x]++
and it doesn't in any
2010-01-11, 14:26(+00), Stephane CHAZELAS:
> 2010-01-9, 06:23(-06), den...@netstrata.com:
> [...]
>> This produces the correct distribution of dice values for two six-sided dice:
>>
>> $ unset dice; for i in {1..1}; do ((dice[$RANDOM%6+1 +
>> $RANDOM%6+1]++)); done; echo "${di...@]}"
>> 290
On 1/11/10 9:26 AM, Stephane CHAZELAS wrote:
> 2010-01-9, 06:23(-06), den...@netstrata.com:
> [...]
>> This produces the correct distribution of dice values for two six-sided dice:
>>
>> $ unset dice; for i in {1..1}; do ((dice[$RANDOM%6+1 +
>> $RANDOM%6+1]++)); done; echo "${di...@]}"
>> 29
2010-01-9, 06:23(-06), den...@netstrata.com:
[...]
> This produces the correct distribution of dice values for two six-sided dice:
>
> $ unset dice; for i in {1..1}; do ((dice[$RANDOM%6+1 + $RANDOM%6+1]++));
> done; echo "${di...@]}"
> 290 582 837 1130 1375 1635 1315 1126 845 574 291
>
> The
Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='ba
11 matches
Mail list logo