Closed amiika closed 5 years ago
replaceRandomSyntax could use single regexp instead of current scan/split/sub implementation. For random numbers it could be something like:
(((\d+)..(\d+)\??(\d+)?+?(\d+)?|(\d+),(\d+));?([a-z]+)?:?(\d+)?)
(1..7+2) -> Sequence from 1 to 7 in step 2 (1..7?3) -> Pick random 3 from 1..7 (1..7;qe) -> 1..7 in random order zipping note lengths (1..3:3) -> 1..3 in random order 3 times
Refactored random syntax. Added syntax from previous comment.
Sequences must now be randomized using ~, for example: (1..7) -> 1234567 (1..7~) -> 6543271
Notable changes in random number generation:
Refactored (1,3,2) to (1,3*2) -> Randomize two digits between 1,3 two times, for example: 21 Added new syntax (1,3:3) -> Randomize two digits between 1,3 and repeat 3 times, for example: 222
Works also with sequences: (1..7?3*3) -> 217563426
Random syntax can now generate random numbers for example:
(2000,3000,2) -> 2345 2984 (20,30,2;qe) -> q2e7 q2e5 (1..4) -> 3214 (1..3;hqe) -> h1q3e2
It would be nice to also have some sequence notation that could produce sequences with explicit or random steps. Simple syntax for following examples:
(1..10).step(2).to_a (1..10).step(rrand_i(1,4)).to_a