Don't click here unless you want to be banned.

## LSL Wiki : randomVector

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
Still work in progress.
It compiles, and the little bits are good.

```//////
//    OK, so randBetween is from the llFrand page
//    we can use it to generate a random number from  minimum to maximum.
//    You will see how it works in the example below
////    and yes, I flip around with color and colour - in my comments its colour, in code, I concede to LL

float randBetween(float min, float max)
{
return llFrand(max - min) + min;
}

//////
//  Colours are expressed in vectors.
//   So, below gives us a basic random colour generator

vector randColor()
{
return <llFrand(1.0), llFrand(1.0), llFrand(1.0)>;    //sends back a message to whoever asks the random colour
}

//////
//  Taking it one step further
//   So, below gives us a basic random colour generator

vector randVector()
{                         //HERE we use the randBetween we have up on top to
//make a random number from 100 to 500 - on the Z axis. Fun for a trampoline :)
return <0,0,randBetween(100, 500)>;
}

default
{
touch_start(integer total_number)
{
vector tempRandomColor = randColor();  //this loads temp ariable with random colur
llSay(0, (string)tempRandomColor );    //this says the vector, just to know its working

llSetColor(tempRandomColor, ALL_SIDES); //set colour
///here we push the person who touched cube,
llPushObject( llDetectedKey(0), randVector(), ZERO_VECTOR, 0);
}
}```

back to functionLibrary