C:/Musimathics_local/Musimat/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().

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

Static Void para1 (  ) 

Definition at line 26 of file C091204d.cpp.

References randTendency().

00026                     {
00027 /*****************************************************************************
00028 For example, if L1 and L2 are as shown in the following table, the values in the middle row are 
00029 random values chosen from between.  
00030 *****************************************************************************/
00031 
00032         Print("*** Random Tendency Mask ***");
00033         IntegerList L1( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 );
00034         Print("First list:", L1);
00035         Integer pos1 = 0;
00036         IntegerList L2( 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
00037         IntegerList R;
00038         Integer pos2 = 0;
00039         Integer inc = 1;
00040         For( Integer i = 0; i < Length( L1 ); i = i + 1 )
00041                 R[ i ] = randTendency( L1, pos1, L2, pos2, inc );
00042         Print("Result:", R);
00043         Print("Second list:", L2);
00044 
00045 }}

Integer randTendency ( IntegerList  L1,
Integer Reference  pos1,
IntegerList  L2,
Integer Reference  pos2,
Integer  inc 
)

Definition at line 16 of file C091204d.cpp.

References cycle(), Random(), and x.

00017                                                                      {
00018         Integer x = cycle(L1, pos1, inc);
00019         Integer y = cycle(L2, pos2, inc);
00020         If (x < y)
00021                 Return(Random(x, y));
00022         Else
00023                 Return(Random(y, x));
00024 }


Generated on Fri Sep 8 23:11:09 2006 for Musimat Chapter 9 Code Examples by  doxygen 1.4.7