Dokumentaatio/Calcin funktiot/SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ

From The Document Foundation Wiki
Jump to navigation Jump to search
This page is a translated version of the page Documentation/Calc Functions/RANDBETWEEN.NV and the translation is 54% complete.
Other languages:
English • ‎Nederlands • ‎dansk • ‎español • ‎suomi



Funktion nimi:

SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ

Kategoria:

Matemaattinen

Yhteenveto:

Generates a random integer that lies in a specified range. In contrast to RANDBETWEEN, RANDBETWEEN.NV is a non-volatile function that is not recalculated at every input event.

Syntax:

RANDBETWEEN.NV(Bottom; Top)

Tuottaa:

Tuottaa satunnaisen kokonaisluvun, joka sijaitsee määritellyllä välillä [Alinhaluttuluku, Ylinhaluttuluku].

Argumentit:

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 RANDBETWEEN.NV reports a #VALUE! error.
  • If Bottom is greater than Top, then RANDBETWEEN.NV reports an invalid argument error (Err:502).
  • If either Bottom or Top is a non-integer value, then RANDBETWEEN.NV 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 RANDBETWEEN.NV returns their common value.

Additional details:

  • RANDBETWEEN.NV is a non-volatile function. Such functions are not recalculated at new input events and do not recalculate when selecting Data ▸ Calculate ▸ Recalculate or pressing F9, except when the cell containing the function is selected. Non-volatile functions are recalculated when opening the file.
  • Use the RANDBETWEEN 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 =RANDBETWEEN.NV(), and use Edit ▸ Paste Special (with All and Formulas deselected and Numbers selected).
  • Use Sheet ▸ Fill Cells ▸ Fill Random Number to fill a selected cell range with random numbers, generated in accordance with the flexible settings available through the Random Number Generator dialog.
  • To generate numbers in the range [0, 1), use the RAND function or its non-volatile equivalent RAND.NV.

Esimerkkejä:

Template:Calc-Formula/fi Template:Calc-Description/fi Template:Calc-Returns/fi
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(20; 30) Generates 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), viittaa soluihin D1 ja D2 jotka sisältävät luvut -10 ja 10. Generates 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. Not a particularly helpful use of a random number generator but included to demonstrate that negative numbers are rounded away from 0. -7
=SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ(9.2; 9.2) Always returns 10. Again, not a particularly helpful use of a random number generator but included to demonstrate that positive numbers are also rounded away from 0. 10

Samankaltaisia LibreOffice-funktioita:

SATUNNAISLUKU

SATUNNAISLUKU.PYSYVÄ

SATUNNAISLUKU.VÄLILTÄ

ODF standard:

None.

Equivalent Excel functions:

None.