Login     Register

        Contact Us     Search

XLeratorDB/statistics Documentation

SQL Server PERMUTATIONA function


PERMUTATIONA
Updated: 30 May 2017

Use the SQL Server scalar function PERMUTATIONA to calculate the number of permutations with replacement defined as:

Syntax
SELECT [wct].[PERMUTATIONA] (
   <@n, int,>
  ,<@k, int,>)
Arguments
Input NameDefinition
@nNumber of items
@kNumber chosen
Return Type
float
Remarks
Examples
Example #1
SELECT wct.PERMUTATIONA(10,3) as PERMUTATIONA

This produces the following result.

Example #2

Calculate the probability of 2 people having the same birthday in a room containing n people.

SELECT
     x.n
    ,1 - wct.PERMUT(365,x.n)/wct.PERMUTATIONA(365,x.n) as [p(n)]
FROM (VALUES
    (10),(20),(22),(23),(30),(57))x(n)

This produces the following result.

See Also


Copyright 2008-2017 Westclintech LLC         Privacy Policy        Terms of Service