ntile()

Read(2128) Label: subset, bucket number,

Description:

Get the bucket number of the subset where a certain member of the set settles.

Syntax:

ntile(i,n)

Divide a set of natural numbers into a number of subsets of equal length k, and find out the bucket number of the subset where the ith member settles

ntile(i,k,n)

Divide a set with length of n into a number of subsets of equal length k, and find out the bucket number of the subset where the ith member settles

Note:

When the length of set is specified, the to-be-calculated member need to be less than or equal to it, that is, i<=n.

Parameter:

i

The sdequence number of a member, which is an integer and meets i<=n

k

The length of each subset, which is an integer

n

Length of the set, which is an integer

Return value:

Integer

Example:

ntile(13,5)

3

ntile(13,5,19)

4