Jump to content

Dokumentaatio/Calcin funktiot/SATUNNAISLUKU.PYSYVÄ

From The Document Foundation Wiki
This page is a translated version of the page Documentation/Calc Functions/RAND.NV and the translation is 13% complete.


Function name:

SATUNNAISLUKU.PYSYVÄ

Category:

Mathematical

Summary:

Generates a uniformly distributed random number in the range 0 (inclusive) to 1 (exclusive). In contrast to SATUNNAISLUKU, SATUNNAISLUKU.PYSYVÄ is a non-volatile function that is not recalculated at every input event.

Syntax:

SATUNNAISLUKU.PYSYVÄ()

Returns:

Tuottaa kokonaisluvun väliltä [0,1).

Arguments:

None.

Additional details:

  • SATUNNAISLUKU.PYSYVÄ 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 SATUNNAISLUKU 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.PYSYVÄ(), 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 a range other than [0, 1), either:
    • Scale the value returned by SATUNNAISLUKU.PYSYVÄ to a new range using a formula of the form =(SATUNNAISLUKU.PYSYVÄ()*(b-a))+a to generate a number in the range [a, b). For example, the formula =(SATUNNAISLUKU.PYSYVÄ()*20)-10 would generate random numbers in the range [-10, 10).
    • Use the SATUNNAISLUKU.VÄLILTÄ function or its non-volatile equivalent SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ.

Examples:

Formula Description Returns
=SATUNNAISLUKU.PYSYVÄ()

Generate a random number r in the range 0 ≤ r < 1. The resulting value will not change whenever Calc recalculates.

0,80206289793007

Related LibreOffice functions:

SATUNNAISLUKU

SATUNNAISLUKU.VÄLILTÄ

SATUNNAISLUKU.VÄLILTÄ.PYSYVÄ

ODF standard:

None. See instead ORG.LIBREOFFICE.RAND.NV.

Related (or similar) Excel functions:

None.