Bug 148863 - If a matrix created by RANDBETWEEN.NV function is transposed, it will not be random number.
Summary: If a matrix created by RANDBETWEEN.NV function is transposed, it will not be ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1 all versions
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.4.0 target:7.3.4
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2022-04-30 08:21 UTC by nobu
Modified: 2022-05-16 08:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (12.74 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-04-30 08:25 UTC, nobu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nobu 2022-04-30 08:21:48 UTC
Description:
If a matrix created by RANDBETWEEN.NV function is transposed, it will not be random number.


Steps to Reproduce:
1.Cell A1: =TRANSPOSE(IF({0|0|0}=0;RANDBETWEEN.NV(1;100)))
2.Ctrl + Shift + Enter
3.

Actual Results:
Three same numbers line up at Cells A1:C1.

Expected Results:
Three random numbers are lined up at Cells A1:C1.


Reproducible: Always


User Profile Reset: No



Additional Info:
Example_1
Cell A1: {=IF({0|0|0}=0;RANDBETWEEN.NV(1;100))}
Three random numbers are lined up at Cells A1:A3.
This is the right result.

Example_2
Cell A1: {=TRANSPOSE(IF({0|0|0}=0;RANDBETWEEN(1;100)))}
or
Cell A1: {=TRANSPOSE(IF({0|0|0}=0;com.sun.star.sheet.addin.Analysis.getRandbetween(1;100)))}
Three random numbers are lined up at Cells A1:C1.
This is the right result.

Version: 7.1.6.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 2; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: ja-JP
Ubuntu package version: 1:7.1.6-0ubuntu0.21.04.1
Calc: threaded

Version: 7.3.1.3 (x86) / LibreOffice Community
Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
CPU threads: 4; OS: Windows 10.0 Build 10240; UI render: default; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: threaded
Comment 1 nobu 2022-04-30 08:25:12 UTC
Created attachment 179855 [details]
sample file
Comment 2 Eike Rathke 2022-05-02 10:58:15 UTC
Same for
=TRANSPOSE(IF({1,1,1};RAND()))
already since 6.1.z
=IF({1,1,1};RAND()) works as expected.
Comment 3 Commit Notification 2022-05-12 19:43:59 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9391e9fb99a87e71897e29da79eba084682fdaa5

Resolves: tdf#148863 In JumpMatrix context use its dimensions for results

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Eike Rathke 2022-05-12 19:55:04 UTC
This fixes the example of comment 2 but not the original with {0|0|0}=0 comparison result (with ; semicolon array row separator {0;0;0}=0 ).
Comment 5 nobu 2022-05-12 23:48:45 UTC
(In reply to Eike Rathke from comment #4)
> This fixes the example of comment 2 but not the original with {0|0|0}=0
> comparison result (with ; semicolon array row separator {0;0;0}=0 ).

Looking at the English version ASK, I know that if I post it by mistake in my own location, I will be abused.

So, I posted a copy of the "Formula" property instead of "FormulaLocal" one using MRI Tool.

Probably, I thought this was a standard formula.

However, I also posted a sample file at the same time, because it may not be possible to communicate with language issues and formula expressions.

And...
The formula of the sample file posted at the same time is not "IF({0;0;0}=0", but "IF({1;1;1}" similar to your post.

How to make it easy to understand, I accidentally posted the formula in the middle of trial and error.
I tried to fix it immediately, but I didn't know how to do it.
I also posted a sample file, so I thought it wasn't wrong.

Anyway, thank you for being interested in my first post and working on the correction.
Comment 6 Commit Notification 2022-05-13 00:19:24 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4bd8eb13e1e2693961fdb9c19c403fde9d163de1

Use interpreter stack to determine JumpMatrix context, tdf#148863 follow-up

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2022-05-13 13:30:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/02367bacafe99fcfaa64c20fad0df50ba0b2301d

tdf#148863: sc_uicalc: Add unittest

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2022-05-16 08:30:54 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/c6cdfd364963ada3fc12aa35ecc8c641eff0276c

Resolves: tdf#148863 In JumpMatrix context use its dimensions for results

It will be available in 7.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2022-05-16 08:31:03 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/9501315fc7baa9b7b32834252375afc39379305b

Use interpreter stack to determine JumpMatrix context, tdf#148863 follow-up

It will be available in 7.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.