Article View: es.comp.os.linux.programacion
Article #13242Re: numero aleatorio
From: tas
Date: Sun, 11 Mar 2001 18:25
Date: Sun, 11 Mar 2001 18:25
18 lines
1274 bytes
1274 bytes
Manuel escribi�: M> M> �Como puedo obtener un numero aleatorio (entre 0 y uno dado) M> en un script del shell ? Un 'echo $RANDOM' devuelve un n�mero aleatorio entero y positivo. Si pones el l�mite superior en la variable "SUP", entonces $(( $RANDOM % ($SUP+1) )) te da lo que pides. (Seguramente es una chapuza, as� que espera un poco a ver si llega alguna otra respuesta :) Saludos. -- Debian GNU/Linux
Technical Details
Message-ID:
<5ufg89.487.ln@127.0.0.1>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mailReferences:
<98fr6a$d76$1@m2newsreader01.wanadoo.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,ed1072d8aeffb133,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-03-11 10:30:07 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed.cwix.com!newsfeed.bcn.ttd.net!news.bcn.ttd.net!not-for-mail
From: tas <tas@subdimension.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: numero aleatorio
Date: Sun, 11 Mar 2001 19:25:09 +0100
Organization: Bits & Bobs Inc.
Lines: 18
Message-ID: <5ufg89.487.ln@127.0.0.1>
References: <98fr6a$d76$1@m2newsreader01.wanadoo.es>
NNTP-Posting-Host: acceso-b1.mad.idec.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (Linux/2.2.18 (i586))