# Using random to return values with preference to the outer range

## Recommended Posts

Hello everyone!

Currently randoms syntax of "random [0,5,10]" produces random numbers between 0 and 10, with preference to the center of that range.

Is there any way to have random prefer both outer edges of that range, instead of the center?

Thank you,

##### Share on other sites

I re-read my post and I was unsure if I was making my goal clear.

Currently I have two ranges subtracted against a 2d position, both are randomized using [-100,0,100] producing figure A in the below image.  What would it take to get something similar to figure B?

http://i.imgur.com/QVH9BTg.png

##### Share on other sites

According to the examples, I understand that a higher mid value than max and min, generates a higher number. So I guess that you can use

floor(random [50,100,50]) * selectRandom [1,-1];

The last is just to generate negative numbers also. There's most likely a better way. Increase min and max to increase the generated number.

##### Share on other sites

Hello everyone!

Currently randoms syntax of "random [0,5,10]" produces random numbers between 0 and 10, with preference to the center of that range.

Is there any way to have random prefer both outer edges of that range, instead of the center?

Thank you,

this should do exactly what u want:

```if ((random 10) < 5) then
{
_value = random [0, 100, 0];
}
else
{
_value = random [0, -100, 0];
};
```
Edited by sarogahtyp

##### Share on other sites

hmm... idk what is faster but while thinking about both solution I figured out that fiddi did the same with another way :)