User Tools

Site Tools


jvs:cigal:manual:chapter3:ramp

CIGAL Reference Manual, Chapter 3 (Functions): ramp

Ramp -- Generate a ramped sequence of numbers

usage: buf = ramp(nvals,low,high,incr,repet,altflg,seed)

RAMP generates a list of NVALS integers, starting at value SEED, and incrementing by INCR each time. When the list gets to value HIGH it starts again at LOW. If REPET is non-zero, each value will be repeated REPET times before incrementing. If ALTFLG is non-zero, the increment value alternates between increasing and decreasing each time HIGH or LOW is reached; values ramp from SEED to HIGH, then ramp from HIGH to LOW, LOW to HIGH, etc.

By default, NVALS is the length of the target variable (if specified), LOW is 0, INCR is 1, REPET is 0, and ALTFLG is 0. HIGH is the largest legal value (determined by the target word size) and SEED defaults to LOW.

Note: If INCR is negative then the arguments LOW and HIGH are actually the highest and lowest values, respectively.

Examples:

          ramp(10)             -->   0, 1, 2, 3, 4, 5, 6, 7, 8, 9
          buf(0:4) = ramp()    -->   0, 1, 2, 3, 4
          ramp(10,20,22,1,2)   -->  20,20,21,21,22,22,20,20,21,21
          ramp(10,20,,-2)      -->  20,18,16,14,12,10, 8, 6, 4, 2
          ramp(10,0,4,,,1,2)   -->   2, 3, 4, 3, 2, 1, 0, 1, 2, 3

See Also:
MAKLUT(3), RANDOM(3)

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/ramp.txt · Last modified: 2023/02/23 18:43 (external edit)