This technique could be useful for triggering multi-sample drum hits of the same type for more variety in drum sequencing.
To use the Max patch, first set up an External MIDI Track in Logic. Create some MIDI data on that External MIDI Track using the pitch that should trigger the random notes. Route the output of the MIDI track to a virtual path and channel, as shown below. This will be the virtual path going from Logic to the Max patch.
Set up the Max patch using the Trigger Pitch, Pitch Range, Input device (i.e. from Logic to the Max Patch) and output device (i.e. from the Max patch to Logic).