FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Filling an array with random input doesn't quite work
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) [message #185216 is a reply to message #185211] Wed, 12 March 2014 21:08 Go to previous messageGo to previous message
Mr Oldies is currently offline  Mr Oldies
Messages: 241
Registered: October 2013
Karma:
Senior Member
On Wed, 12 Mar 2014 13:18:19 -0400, richard wrote:

> $x=1;
> while ($x<40){
> $yr=range(60,69);
> shuffle($yr);
> $ayr[$x]=$yr[$x];
> echo $ayr[$x]."<br>";
> $x++;
> }
>
>
> I am attempting to load an array based upon the range of numbers 60 through
> 69.
> The array will have 40 items.
> This code produces 9 items just fine.
> The rest of the array is empty.
> What am I missing?

http://mroldies.net/daily/daily2.php

$x=1;
while ($x<40){
$yr=rand(1,10);
$yr=$yr+59;

$num=rand(1,100);
if ($num<100){$num="0".$num;}
if ($num<10){$num="0".$num;}

$song[$x]="http://mroldies.net/audio/19$yr/".$yr."-".$num.".mp3";

$x++;

}


At this point though, I don't have it worked out to check for duplicats.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: readdir lists randomly
Next Topic: Nested PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 18:54:10 GMT 2024

Total time taken to generate the page: 0.04408 seconds