rng¶
Generates on command a range of numbers in form of a Queue
. The range parameters can be provided at run time.
-
TCfg
¶ Template data type used for the configuration interface of the
rng()
gear.TCfg = Tuple[{ 'start': Integer['w_start'], 'cnt': Integer['w_cnt'], 'incr': Integer['w_incr'] }]
-
rng
(cfg: TCfg, *[, cnt_steps=False, incr_steps=False]) → Queue¶ The type of the generated numbers is determined based on the concrete types of the
TCfg
fields. If any of theTCfg
fields is of typeInt
, the generated numbers will also beInt
.rng()
generates numbers in range fromcfg['start']
tocfg['cnt']
exclusive, with increment ofcfg['incr']
.drv(t=Tuple[Uint[2], Uint[4], Uint[2]], seq=[(2, 14, 2)]) \ | rng \ | shred
If
cnt_steps = True
, thenrng()
generatescfg['cnt']
numbers starting fromcfg['start']
with increment ofcfg['incr']
-
rng
(cfg: Integer['w_cnt']) → Queue['cfg'] Generates numbers from
0
tocfg['cnt'] - 1
.The example shows the number range generated for the input
cfg = 10
:drv(t=Uint[4], seq=[10]) | rng | shred