🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3274

duda numeros aleatorios php

#3274
From: Rickoj
Date: Thu, 31 Mar 2005 18:36
16 lines
1316 bytes
se que es un poco basico pero no se cual es mi error estoy generando numeros
aleatorios y guardandolos en un arreglo

srand(time());
$numeros=array_fill(0,21,rand(1,100));

con esta funcion me guarda el mismo numero siempre

en cambio si lo hago en un ciclo

$numeros = array ();
srand(time());
for ($i = 0; $i < 21; $i++)
$numeros[$i] = rand (1, 100);

me entrega valores diferentes, estoy utilizando mal la funcion array_fill ?
Technical Details
Message-ID: <d2hg51$mt2$1@news1.nivel5.cl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,75664339df4cdcff,start
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!not-for-mail
From: "Rick_oj" <rick_oj@[sin-esto]tutopia.com>
Newsgroups: chile.comp.programacion
Subject:   duda numeros aleatorios php
Date: Thu, 31 Mar 2005 14:36:27 -0400
Organization: Varios
Lines: 18
Message-ID: <d2hg51$mt2$1@news1.nivel5.cl>
NNTP-Posting-Host: pc-154-157-104-200.cm.vtr.net
X-Trace: news1.nivel5.cl 1112294369 23458 200.104.157.154 (31 Mar 2005 18:39:29 GMT)
X-Complaints-To: news@news1.nivel5.cl
NNTP-Posting-Date: Thu, 31 Mar 2005 18:39:29 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478