While/For Loop

I am looking for a loop that does not cause delay as it processes something like

$ls = "ls";
for($i=5;$i<=15;$i++)
{
	$int = rand(0,1);
	$rand_letter = $ls[$int];
	if ($rand_letter == 'l') $rand_letter="long";
	if ($rand_letter == 's') $rand_letter="short";
	echo $i . ": " . $rand_letter . "
";
}

I still want to be able to receive web requests while this processes. The thought is I want to create an array of random long and short with each of those having a millis assignment such as long = 6000 and short = 3000 I basically want to create a random set for 600000 millis.

$ls = "ls";
for($i=5;$i<=15;$i++)
{
	$int = rand(0,1);
	$rand_letter = $ls[$int];
	if ($rand_letter == 'l') $rand_letter="long";
	if ($rand_letter == 's') $rand_letter="short";
	echo $i . ": " . $rand_letter . "
";
}

Looks like php code. This loop will run 11 times. The $rand_letter assignment will result in either 'l' or 's' being selected.

The loop will execute in just about nothing flat.

I still want to be able to receive web requests while this processes.

Won't happen. On the other hand, that loop takes nearly no time to execute, so I may not understand the "problem".

The thought is I want to create an array of random long and short with each of those having a millis assignment such as long = 6000 and short = 3000 I basically want to create a random set for 600000 millis.

Creating the set of random intervals is not the issue. That can be done very quickly..

It's the farting around for that period of time that will (may) cause you issues. But, you haven't said anything about what that may involve, so, the best we can do is wish you luck.

Yes you are right in that was php code. Sorry trying to get all the wheels spinning the right way essentially what I am wanting to do is make a total random cloud/weather simulation which is requested every 10 minutes from a php page. I want to set a random amount of clouds over the course of 10 minutes. ie loop 1 takes 1 min loop 2 takes 2 mins and so on but all at random so this 10 minutes might have 10 clouds and the next would have 20. I want to be able to still receive requests at any time so there needs to be no delay. I know I can do it with a simple fade back and forth but was trying to add the randomness instead of a set 10 clouds each 1 min apart.

You are looking at a state machine, then. On each pass through loop, see if there is serial data. If so, collect it, and do something if the data represents a full packet.

Then, see if it is time to transition to the next state (i.e. has enough time elapsed to move on).

Of course, this means keeping track of when things occur. The millis() function is perfect for this.