Tutorial made by MillerTime
Well we all know how to do random numbers. If you dont you go like this.
Or you can set limits
Now i have compile this little function to get a random assortment of letters any number of letters and any letter.
Here it is. Now im just writing this up right now actually and checking it tomorrow cuz its late right now but it should work.
So pretty much all this does is get the random letter and add that letter to the rest of the string
Here is something to randomize arrays. its actually really simple.
That was pretty much the tutorial and if you have anything else you would like me to figure out how to randomize. Drop a line at millertime.1247 [at] gmail [dot] com
or msn : three_eyed_scaley_fish [at] hotmail [dot] com
or aim : MillerTime124
or just PM me.
I may add a tutorial on how to randmize things in an array but you can probably figure it out.
Well we all know how to do random numbers. If you dont you go like this.
Or you can set limits
Code :
// hide source code
// hide line numbers
// hide source code
// hide line numbers
1
2 <?
3 $num = rand(3, 25); //that would keep the number between 3 and 25
4 ?>
5
Now i have compile this little function to get a random assortment of letters any number of letters and any letter.
Here it is. Now im just writing this up right now actually and checking it tomorrow cuz its late right now but it should work.
Code :
// hide source code
// hide line numbers
// hide source code
// hide line numbers
1
2 <?
3 function randLetters($letters){
4 $str = "abcdefghijklmnopqrstuvwxyz";//The letters that are going to be gotten randomly..can be changed, i just used the abc's
5 $num = strlen($str);//get the length of the string above
6 $max = 1; /* change to the number of letters you want to get
7 NOTE: the letters will be consecutive if the number is change. like if its is two then it might be "rs"*/
8
9 for($i=1;$i<$letters;$i++){ //lets start a for loop for the number of letters there are
10 $let[$i] = rand(1, $num); //get a random letter for the position of if in $str
11 $letter[$i] = substr($str, $let[$i], $max); //get the letter after getting randomized
12 $string .= $string . $$letter[$i]; //add the letter to the rest of the string
13 }
14 return $string; //return string
15 }
16 ?>
17
So pretty much all this does is get the random letter and add that letter to the rest of the string
Code :
// hide source code
// hide line numbers
// hide source code
// hide line numbers
1
2 <?
3 $num_letters = rand(3, 7); //setting the limits for how many letters. In this case, it must have a minimum of 3 and a max of 7
4 $randomize = randLetters($num_letters); //call the function
5 echo $string; //output the result
6
7 ?>
8
Here is something to randomize arrays. its actually really simple.
Code :
// hide source code
// hide line numbers
// hide source code
// hide line numbers
1
2 <?
3 $array = array('apple', 'banana', 'peach', 'orange');//start an array
4 $rand_value = array_rand($array, 1);//change 1 to the number or values you want to get
5 ?>
6
That was pretty much the tutorial and if you have anything else you would like me to figure out how to randomize. Drop a line at millertime.1247 [at] gmail [dot] com
or msn : three_eyed_scaley_fish [at] hotmail [dot] com
or aim : MillerTime124
or just PM me.
I may add a tutorial on how to randmize things in an array but you can probably figure it out.

Donation:If you like our free quality work, make a donation by using Paypal and tell us what you would like to see improved on our site for the next few months. |
|
MillerTime
Comment #2269 posted on 02-10-2007 01:36
When did i submit this tutorial? I mean i know the date but i don't think i ever visited this site..


























