redis_srandmember()

Read(461) Label: set, random member,

Description:

  Get one or multiple random members from a set.

Syntax:

redis_srandmember(con,key[,count])

Note:

External library function. If parameter count isn’t supplied, return a random member from the set.

If the value of parameter count is positive, return an arrry that could contain duplicate members whose length is count.

Parameters:

con

Database connection string

key

Set name

count

The number of returned members; can be omitted.

Options:

   @i  Enable removing duplicate members and return result

Return value:

A table sequence

Example:

 

A

 

1

=redis_open()

 

2

=redis_srandmember(A1,"fruit")

3

 

=redis_srandmember(A1,"fruit",3)

4

=redis_srandmember(A1,"fruit",5)

5

 

=redis_srandmember@i (A1,"fruit",5)