[PD] random gate based on percentages

Frank Barknecht fbar at footils.org
Fri Jul 13 00:47:39 CEST 2007

mark edward grimm hat gesagt: // mark edward grimm wrote:

> ...i just built an abstraction that will take a
> message from the left inlet and pass it to the left
> outlet randomly n% of the time.  the others will be
> passed as a bang to the right outlet.
> just wondering if this looks ok or if there is a
> better way to do it which i assume there is based on

The basic approach is perfect. I would remove the numberbox, as this
is potentially a CPU hog, and in an abstraction you don't see it
anyways, and instead of [expr 1-$f1] in your case [== 0] is more what
you want.

*BUT*: There is a deep problem with triggering and execution order in
your patch: You have three patch cords coming out of the first
[inlet]: so called "fanning" connections. You must be aware that the
order, in which these cords get activated, is important for your patch
to work correctly. To make sure, that this ordering is actually  the
way you want it, you *must* use a trigger object: [t a a a]. Search
the list-archives for some of my longer explanations why this is so

 Frank Barknecht                 _ ______footils.org_ __goto10.org__

More information about the Pd-list mailing list