random assessment
Moderator: General Moderators
random assessment
how can i randomize my assessment in every load of the page?
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: random assessment
My crystal ball is out for service, but if you want real advice, you're going to need to be a bit more descriptive.
Re: random assessment
Code: Select all
<?php
$strMessage = 'my assessment';
$aryKeys = range(0,strlen($strMessage)-1);
shuffle($aryKeys);
$strRandom = '';
foreach($aryKeys as $index) {
$strRandom .= $strMessage{$index};
}
echo "$strRandom\n";
?>- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: random assessment
Hah! I wasn't expecting that. Good one!twinedev wrote:(LOL, little loopy from being sick)Code: Select all
<?php $strMessage = 'my assessment'; $aryKeys = range(0,strlen($strMessage)-1); shuffle($aryKeys); $strRandom = ''; foreach($aryKeys as $index) { $strRandom .= $strMessage{$index}; } echo "$strRandom\n"; ?>
Re: random assessment
.,thanks guys
Re: random assessment
Was just being silly while waiting for more details on what you were actually looking for.... Like I said, was pretty loopy at the time... And getting that way again from only 2 hour nap since getting up about 38 hours ago.
Re: random assessment
ohh..not the string.,what i mean is the itemtwinedev wrote:(LOL, little loopy from being sick)Code: Select all
<?php $strMessage = 'my assessment'; $aryKeys = range(0,strlen($strMessage)-1); shuffle($aryKeys); $strRandom = ''; foreach($aryKeys as $index) { $strRandom .= $strMessage{$index}; } echo "$strRandom\n"; ?>
Re: random assessment
"how can i randomize my assessment in every load of the page?"
That is what we need defined to know what you are trying to randomize.
-Greg
That is what we need defined to know what you are trying to randomize.
-Greg
Re: random assessment
@twinedev
its ok, i already got the right logic of it..but there is another problem.. how can i escape / unpost some duplicate of my query??
coz i use the rand() function and loop it.
its ok, i already got the right logic of it..but there is another problem.. how can i escape / unpost some duplicate of my query??
coz i use the rand() function and loop it.