License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

random generation of a '-1' or '1' flag?

__archiben
Booster
as a GDL newbie, (i'm slowly getting through the first section DNC's cookbook), i'm a little lost with this:

is there any way i can create a random '-1' or '1' flag for a random positive/negative ADD and ROT command?

i can generate the random amount i want to offset/rotate, but i want to multiple by the -1 or 1 as well for a truer randomisation.

hoping . . .
~/archiben
b e n f r o s t
b f [a t ] p l a n b a r c h i t e c t u r e [d o t] n z
archicad | sketchup! | coffeecup
3 REPLIES 3
Anonymous
Not applicable
You can use the RND function for this.
Page 2.40 of the Cookbook look also at the chapter Maths bits.
Not sure if it is exactly what you are asking for, but may be this can help.
Anonymous
Not applicable
Ben;

Try playing with the below...

HTH - Stuart
_____________________________

!*** Ben's Random Flag v1.0 ***

oRandom = rnd(0.9999999)
if oRandom > 0.5 then oFlag = +1 else oFlag = -1
text2 0,0, oFlag


!*** Ben's Random Flag v2.0 ***

oFlag = 2*(int(rnd(1.99999)))-1


!*** Ben's Random Angle v1.0 ***

oMinimumAngle = -90
oMaximumAngle = +90
oRotation = rnd (oMaximumAngle - oMinimumAngle) +oMinimumAngle
__archiben
Booster
thanks guys!

~/archiben
b e n f r o s t
b f [a t ] p l a n b a r c h i t e c t u r e [d o t] n z
archicad | sketchup! | coffeecup

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!