ScriptSpot

Forum topic · General Scripting

Random generation from predefined values?

By Vapourise · 2011-10-21

Description

Hi, I know it is possible to create with Random 1 100 but how do you create by randomly selecting pre-defined values e.g.

Create a box by randomly selecting 50 100 150 or 200 for the length.

cheers, K

Comments (1)

mjbg · 2011-10-21

you can create an array with the lengths you want and use it to create the box

something like this:


_arrayLengths = #(50,100,150,200) -- desired length

Box length:_arrayLengths[random 1 _arrayLengths.count] width:100 height:100