Array op should generate values from 0 to 1 included

Tags: #<Tag:0x00007f7038c810e0>

I think there is a ‘bug’ in the Array OP when you want to generate values between 0 and 1 or 1 - 0, the first and last value should be 0 and 1. (1 and 0) respectively. Here is the fix (just removing 1 in the division).

Line 73

for (i = 0; i < arrLength; i++)
    arr[i] = i / (arrLength - 1);

Line 83

for (i = 0; i < arrLength; i++)
    arr[i] = 1-i / (arrLength - 1);


first of all, thanks for reporting and even providing code for a solution!

we talked about this and it’s a rather philosophical issue so we won’t “fix” the current behaviour.

the reason is that if you use 0-1 and put in 10 fields you get smooth steps 0, 0.1, 0.2, 0.3 …if we change this to your wanted behaviour (apart from breaking a lot of stuff) you’d have to put in 11 fields for 0-1 to get the same result…this seems somehow counterintuitive.

you could chain the current op with some math (Divide, Multiply, MapRange) to get your desired output though…maybe that is some kind of “comprimise”…


Hey Stephan,
Yes I get the dilemma, in my custom op I still have only 10 values but each step is not 0.1, 0.2 etc.
Maybe just update the documentation, saying 0-[1] not included.

EDIT: I edited the documentation for this op to add this precision.

Congrats, on the new release btw, it rocks.