rand_static()

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
howmando4
Posts: 1
Joined: Tue Mar 17, 2009 6:24 pm
Contact:

rand_static()

Post by howmando4 »

has anyone been able to get the rand_static() thing to work? I'm not really sure how to use it - I couldn't find any examples.
[null]

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

My Op Art #1 makes use of rand_static(). The key thing about rand_static() is that each call to rand_static() results in a random number that is constant. If you have a rule with rand_static() in it then you won't get a different random number each time the rule is expanded. It will always be the same random number.

The reason why Context Free doesn't have a random function that is different each time a rule is expanded is because the Context Free execution engine is not powerful enough to do it. rand_static() is the best that we can do.The next version of Context Free will have a fully dynamic random number function.

User avatar
pakin
Posts: 43
Joined: Sat Apr 21, 2007 8:59 pm
Location: United States
Contact:

Post by pakin »

Humor link: http://xkcd.com/221/

Okay, rand_static() at least gives a different constant each time Context Free is run. :wink:

Post Reply