[Solved] RANDBETWEEN numbers keep changing

Discuss the spreadsheet application
Post Reply
ronanski
Posts: 24
Joined: Wed Apr 15, 2020 12:23 pm

[Solved] RANDBETWEEN numbers keep changing

Post by ronanski »

Im using lists of randomly generated numbers and iv just noticed that they have been changing. The first 8 out of 10 lists have now all got different numbers than when I first started making the document, but I haven't touched those cells since, why would this happen and is there a way to stop it?
Last edited by robleyd on Tue Jun 02, 2020 2:55 pm, edited 3 times in total.
Reason: Add green tick
Open office 4.1.7 on mac os mojave 10.14.6
User avatar
robleyd
Moderator
Posts: 5086
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: randbtween numbers keep changing

Post by robleyd »

From the HELP -F1:

RANDBETWEEN
Returns an integer random number in a specified range.
Syntax
RANDBETWEEN(Bottom; Top)

Returns an integer random number between integers Bottom and Top (both inclusive).
This function produces a new random number each time Calc recalculates. To force Calc to recalculate manually press Shift+Ctrl+F9.

To generate random numbers which never recalculate, copy cells containing this function, and use Edit - Paste Special (with Paste All and Formulas not marked and Numbers marked).
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: RANDBETWEEN numbers keep changing

Post by Villeroy »

robleyd wrote:This function produces a new random number each time Calc recalculates.
RANDBWTWEEN(A1;B1) recalculates when A1 or B1 change, when you edit the formula, when the document is (re-)loaded or when Ctrl+Shift+F9 enforces a complete recalculation.
RAND() recalculates with every recalculation anywhere in the same document. RAND() is a volatile function. RANDBETWEEN is a regular function.
The solution remains the same. Paste-special can be used to convert formula results into constant values.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
ronanski
Posts: 24
Joined: Wed Apr 15, 2020 12:23 pm

Re: RANDBETWEEN numbers keep changing

Post by ronanski »

Ah thankyou. It seems odd though that this would be an intentional function, especially if there is a way to manually recalculated if you wanted to anyway. Incidentally I do not have an F9 key on my macbookpro so not sure how I would use that function if I needed it.
Open office 4.1.7 on mac os mojave 10.14.6
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Lupp »

(Just a bit off topic:)
In recent versions of LibreOffice Calc RANDBETWEEN() also is volatile as RAND() is.
In pusuit of the old enhancement request (tdf#127831) https://bugs.documentfoundation.org/sho ... ?id=127831 the version 7.0 of LibreOffice (coming soon) will offer two new NonVolatile functions RAND.NV() and RANDBETWEEN.NV().
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Villeroy »

Changing the original RANDBEETWEEN to be volatile will break existing spreadsheets.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Lupp »

They did nonetheless.

Just checked some of my preserved versions. It happened with V 6.2.

(I also suspect it wasn't sufficiently considered. Do you remember the "Update-References-When-Sorting-Range-Of-Cells-affair" [Kohei Yoshida]? It must have happened around LibO V4.2.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Villeroy »

Luckily I don't use any spreadsheets except for "cheap database reporting".
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Lupp
Volunteer
Posts: 3553
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Lupp »

Villeroy wrote:Luckily I don't use any spreadsheets except for "cheap database reporting".
Looking at your current avatar I would assume you had to cope a lot with spreadsheets the last few days.
Well, get lucky again!
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Villeroy »

Thank you for the heads up. I'm running with Pluto again.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] RANDBETWEEN numbers keep changing

Post by RoryOF »

@Villeroy: I preferred your butterfly! I felt it gave a certain gravitas to your postings.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Villeroy »

Butterfly. Red and black. Majestic.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
ronanski
Posts: 24
Joined: Wed Apr 15, 2020 12:23 pm

Re: [Solved] RANDBETWEEN numbers keep changing

Post by ronanski »

ctrl + shift + (fn) F9 doesn't do anything...
Open office 4.1.7 on mac os mojave 10.14.6
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Zizi64 »

ctrl + shift + (fn) F9 doesn't do anything...

______________________________________________
Open office 4.1.7 on mac os mojave 10.14.6
It works on Windows. You must know what hotkey recalculation will activize on your operating system. Try to check it from the menu.
Recalculate.png
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
ronanski
Posts: 24
Joined: Wed Apr 15, 2020 12:23 pm

Re: [Solved] RANDBETWEEN numbers keep changing

Post by ronanski »

I seem to have a different menu system to you. Was gonna upload a screenshot but it says maximum size is 128Kb, never heard of an image file being that small
Open office 4.1.7 on mac os mojave 10.14.6
User avatar
Hagar Delest
Moderator
Posts: 32665
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Hagar Delest »

ronanski wrote:Was gonna upload a screenshot but it says maximum size is 128Kb, never heard of an image file being that small
:lol:
Then look at the screenshot from the post above yours. It's only 48kB.
Just crop your screenshot, reduce the color depth if really necessary.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
ronanski
Posts: 24
Joined: Wed Apr 15, 2020 12:23 pm

Re: [Solved] RANDBETWEEN numbers keep changing

Post by ronanski »

well its already cropped to the size i need. I have no idea how to reduce colour depth
Open office 4.1.7 on mac os mojave 10.14.6
User avatar
Hagar Delest
Moderator
Posts: 32665
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: [Solved] RANDBETWEEN numbers keep changing

Post by Hagar Delest »

You can use a 3rd party site for sharing files.
With any picture manager there should be a menu dealing with colors and reducing the number of colors.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Post Reply