Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A strange function behaviour in random password generator
- X-seq: zsh-users 15611
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: nix@xxxxxxxxxxxxxxxx
- Subject: Re: A strange function behaviour in random password generator
- Date: Mon, 6 Dec 2010 14:39:41 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4Out6aGnuhDMHCVXu6dgsxjxTsWMJOwk0WVa/3XZ1kM=; b=UR1WUBp/GY9iFnGyzQnGGQGL6y3jFd5I0Tz3+rdGZhmS+fRcwM/spdm8LIhFqbwE/1 FoGj1TN4H8zmpJood5s4+1GSvBJsMPjP2GGSM49SyvQ0sjqBgd6PHSef+482rvmFNCE9 wJELF6rcv6JC8eR+2z9UlHZ/eXp5lHa77cWH0=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=sV4eNGyfdZ5uoigaBaxZeWx4LYp+xcmLVxLYFxqqG3fV1dsktWqU0tnTsuqDSgpyQP 0PUn+u/aIlCBsFT6zchoO+/feaE1zvFWo5pbA/87sUvVJRodbKk+TTis1L+QtBQYheuO fBvD5yzeJ+SMtj2M20vKULgpRCovHNBm7u+Kk=
- In-reply-to: <6741cd3f3c35661a5b89e0078c20a0f6.squirrel@xxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <6741cd3f3c35661a5b89e0078c20a0f6.squirrel@xxxxxxxxxxxxx>
On 6 December 2010 14:15, <nix@xxxxxxxxxxxxxxxx> wrote:
> Hi, I have just coded a random password generator. It works good but one
> might want to show me how to do it with rand48() as itæ output is
> strange.
>
> The problem:
>
> ./random_pass.sh
> iNkiuG
> iNkiuG6K
>
> 6 first chars are the same for both passwords.
> [...]
> pos=$((RANDOM%$seeds_count+1))
> MY_RCON=$(random 6)
> MY_PASS=$(random 8)
If you access $RANDOM in a subshell, the parent shell doesn't know
about it, and next time it forks a subshell the state will be
identical.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author