Functions

/Users/garethloy/Musimathics/Musimat1.2/MusimatChapter9/C091204d.cpp File Reference

#include "MusimatChapter9.h"

Go to the source code of this file.

Functions

 MusimatChapter9Section (C091204d)
Integer randTendency (IntegerList L1, Integer Reference pos1, IntegerList L2, Integer Reference pos2, Integer inc)
Static Void para1 ()

Function Documentation

MusimatChapter9Section ( C091204d   )

Definition at line 2 of file C091204d.cpp.

References para1().

                                 {
        Print("*** Random Tendency Mask ***");
        /*****************************************************************************
         
         Random Tendency Mask
         
         We can use a row to specify an upper boundary and another row to 
         specify a lower boundary, and then pick a pitch in this range. We can pick any pitch in the range, either 
         the median pitch or a random pitch or even all pitches, depending upon what we want to use it for. This 
         example returns a random value lying between two rows that act as fences to limit the random range.
         *****************************************************************************/
        para1(); // Step into this function to continue.
}
Static Void para1 (  )

Definition at line 27 of file C091204d.cpp.

References randTendency().

                    {
        /*****************************************************************************
         For example, if L1 and L2 are as shown in the following table, the values in the middle row are 
         random values chosen from between.  
         *****************************************************************************/
        
        Print("*** Random Tendency Mask ***");
        IntegerList L1( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 );
        Print("First list:", L1);
        Integer pos1 = 0;
        IntegerList L2( 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
        IntegerList R;
        Integer pos2 = 0;
        Integer inc = 1;
        For( Integer i = 0; i < Length( L1 ); i = i + 1 ) {
                R[ i ] = randTendency( L1, pos1, L2, pos2, inc );
        }
        Print("Result:", R);
        Print("Second list:", L2);
        
}
Integer randTendency ( IntegerList  L1,
Integer Reference  pos1,
IntegerList  L2,
Integer Reference  pos2,
Integer  inc 
)

Definition at line 16 of file C091204d.cpp.

References cycle().

                                                                     {
        Integer x = cycle(L1, pos1, inc);
        Integer y = cycle(L2, pos2, inc);
        If (x < y)
                Return(Random(x, y));
        Else
                Return(Random(y, x));
}