[SOLVED] Random number excludes top number

zon3d

Client
Регистрация
22.03.2012
Сообщения
29
Благодарностей
1
Баллы
3
In ZP4, I have discovered after lots of testing that if you use the Random block, specify the from and to values, you would expect it would randomly selected any of the values between the from and to values (and including the from and to values themselves), but it doesn't.

It does not ever randomly select the to number (but the from number it will select).

For example, if I put the from number as 1 and the to number as 3. It will always just output the numbers 1 or 2, never the number 3.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
It was always that way :-)
If you need 1-10 set 1-11
 

zon3d

Client
Регистрация
22.03.2012
Сообщения
29
Благодарностей
1
Баллы
3
Yes I know it was that way in ZP3, but at least in that version it said in the macros builder that the last value would be excluded.

The label in ZP4 for the randomise block needs to be changed stating that the to value will never be generated.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
It's not a bug ;-)

The main idea behind it that first line in files/tables/lists also number of matches of elements starts with 0.
So.. if you have 5 lines/elements, range 0-5 (or from the start to 5) will give you exact and correct 5 results.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)