Select to view content in your preferred language

Rand

2473
10
11-30-2016 01:57 AM
PmssS
by
New Contributor II

Hi,

CityEngine 2015

is it possible to use 'rand' to randomize only two values, such as:

attr lenght = rand (6 - 12)

the use of "," will give me all the numbers between those two. That is not what I want.

I test this and it worked for a Block (Parameters = No subdivision and Uneven) and I tried again for another block with the same parameters and did not work.

is there an alternative?

cheers

Pedro

0 Kudos
10 Replies
LR
by
Regular Contributor

Ah! When you split it with CGA it's still one shape, so it only has one extrudeFactor. I thought you did Shapes --> Subdivide.

Put this

set(extrudeFactor, 20% : rand(1,3)
 20% : rand (3,5)
 20% : rand (2,4)
 20% : rand (1,2)
 20% : rand (3,4) 
 else: 1)

above your 

extrude (floor(extrudeFactor)*Height)

and change 

extrudeFactor to attr. You can tag it with @Hidden so it doesn't show up in the inspector.

0 Kudos