Dokumentaatio/Calcin funktiot/SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Function name:
SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ
Category:
Mathematical
Summary:
Generates a random integer that lies in a specified range. In contrast to SATUNNAISLUKU.VÄLILTÄ, SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ is a non-volatile function that is not recalculated at every input event.
Syntax:
SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(Bottom; Top)
Returns:
Tuottaa satunnaisen kokonaisluvun, joka sijaitsee määritellyllä välillä [Alinhaluttuluku, Ylinhaluttuluku].
Arguments:
Alinhaluttuluku on halutun alueen alaraja. Sen on oltava kokonaislukuarvo tai viittaus kokonaisluvun sisältävään soluun.
Ylinhaluttuluku on halutun alueen yläraja. Sen on oltava kokonaislukuarvo tai viittaus kokonaisluvun sisältävään soluun.
- If either Bottom or Top is non-numeric, then SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ reports a #ARVO! error.
- If Bottom is greater than Top, then SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ reports an invalid argument error (Virhe:502).
- If either Bottom or Top is a non-integer value, then SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ rounds it away from 0 to the next integer value (positive values rounded towards +∞, negative values rounded towards -∞).
- If Bottom and Top are equal (after any rounding), then SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ returns their common value.
Additional details:
- SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ is a non-volatile function. Such functions are not recalculated at new input events and do not recalculate when selecting ▸ ▸ or pressing F9, except when the cell containing the function is selected. Non-volatile functions are recalculated when opening the file.
- Use the SATUNNAISLUKU.VÄLILTÄ function for a volatile equivalent that satisfies ODF 1.2 and is compatible with Microsoft Excel.
- To generate random numbers that never recalculate, either:
- Copy cells containing
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ()
, and use ▸ (with All and Formulas deselected and Numbers selected). - Use ▸ ▸ to fill a selected cell range with random numbers, generated in accordance with the flexible settings available through the Random Number Generator dialog.
- Copy cells containing
- To generate numbers in the range [0, 1), use the SATUNNAISLUKU function or its non-volatile equivalent SATUNNAISLUKU.PYSYVÄ.
Examples:
Formula | Description | Returns |
---|---|---|
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(20; 30) |
Generate a random integer r in the range 20 ≤ r ≤ 30. The resulting value will not change whenever Calc recalculates. |
22 |
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(D1; D2)
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(D1; D2), viittaa soluihin D1 ja D2 jotka sisältävät luvut -10 ja 10. |
Generate a random integer r in the range -10 ≤ r ≤ 10. The resulting value will not change whenever Calc recalculates. |
6 |
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(−6,1; −6,1) |
Always returns -7. Negative numbers are rounded away from 0. |
−7 |
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(9,2; 9,2) |
Always returns 10. Positive numbers are also rounded away from 0. |
10 |
Related LibreOffice functions:
ODF standard:
None. See instead
ORG.LIBREOFFICE.RANDBETWEEN.NV
.
Related (or similar) Excel functions:
None.