On Wednesday 26 August 2009 23:19:18 Celejar wrote:
> On Wed, 12 Aug 2009 15:26:06 -0500
> "Boyd Stephen Smith Jr." wrote:
> > $RANDOM gives a random number. It has a relatively large range, I think
> > 0-32K maybe even larger.
>
> ...
>
> > Examples:
> > echo $((RANDOM % 6 + 1)) # Rolls a "norma
On Wed, 12 Aug 2009 15:26:06 -0500
"Boyd Stephen Smith Jr." wrote:
...
> $RANDOM gives a random number. It has a relatively large range, I think
> 0-32K maybe even larger.
...
> Examples:
> echo $((RANDOM % 6 + 1)) # Rolls a "normal" die[1].
...
> [1] But not a fair one. If the $RANDOM fu
On 0, Soren Orel wrote:
>I know I could generate numbers like: 0; 1; 2
>with:
>$[ ( $RANDOM % 3 ) + 0 ]
>But how could I generate numbers like: 0; 1; 2; -1; -2; etc? So
>negative+positive numbers too + zero
>thank you
echo $[ ($RANDOM % 5 ) -2 ]
That would generate -2 th
On Wed, Aug 12, 2009 at 04:27:09PM -0500, Ron Johnson wrote:
> Does this burn through entropy faster than other methods?
Probably, although since $RANDOM accesses /dev/urandom instead of
/dev/random , your available entropy remains undefined in any case. As
for the numerical distribution of your
Eric De Mund wrote:
Ron,
John Hasler:
] echo $(( $(( $RANDOM - $RANDOM )) % 3 ))
Ron Johnson:
] Does this burn through entropy faster than other methods?
Yes. Twice as fast. And, more importantly, it's mathematically
incorrect. It does not have the same probability density function as:
ec
Ron,
John Hasler:
] echo $(( $(( $RANDOM - $RANDOM )) % 3 ))
Ron Johnson:
] Does this burn through entropy faster than other methods?
Yes. Twice as fast. And, more importantly, it's mathematically
incorrect. It does not have the same probability density function as:
echo $(( $(($RANDOM % 5)
On 2009-08-12 16:00, John Hasler wrote:
echo $(( $(( $RANDOM - $RANDOM )) % 3 ))
Does this burn through entropy faster than other methods?
--
Scooty Puff, Sr
The Doom-Bringer
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact l
echo $(( $(( $RANDOM - $RANDOM )) % 3 ))
--
John Hasler
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
In <60f50c4a0908121232p4635c385m1d9e0d9b2d935...@mail.gmail.com>, Soren Orel
wrote:
>u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
>bash: -26: command not found
>u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
>bash: -3: command not found
>u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
>bash: -23: command not found
>u
Soren Orel writes:
> u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
> bash: -26: command not found
[...]
> it still doesn't work, and it gives only negative numbers when using e.g.:
> 30-30
First, it's giving an error because it's generating a random number,
then trying to run a program with that
u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
bash: -26: command not found
u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
bash: -3: command not found
u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
bash: -23: command not found
u...@debian:~$ $[ ($RANDOM % 30 ) -30 ]
bash: -2: command not found
u...@debian:~$ $[ ($RANDO
Soren Orel wrote:
I know I could generate numbers like: 0; 1; 2
with:
$[ ( $RANDOM % 3 ) + 0 ]
But how could I generate numbers like: 0; 1; 2; -1; -2; etc? So
negative+positive numbers too + zero
thank you
$[ ($RANDOM % 5 ) -2 ]
?
(I have no idea if I have the bash syntax right)
--
Alan Ch
12 matches
Mail list logo