# Miscellaneous

> Source: https://docs.recombee.com/reql/functions/miscellaneous

> For the complete documentation index, see [llms.txt](/llms.txt).

# Miscellaneous

| Name                                   | Description                                                  | Example                                   |
| -------------------------------------- | ------------------------------------------------------------ | ----------------------------------------- |
| [now](#reql-func-now)                  | Returns current timestamp                                    | now() > timestamp("2015-06-24T17:35:50Z") |
| [random](#reql-func-random)            | Returns a random number between 0 and 1                      | 1\>=random()>=0                           |
| [size](#reql-func-size)                | Returns the length of a string or number of objects in a set | size("Recombee") == 8                     |
| [item\_values](#reql-func-item-values) | Returns property values of a particular item as a dictionary | item\_values("item-42")\["description"\]  |
| [reduce](#reql-func-reduce)            | Reduces a set into a single value using an operator          | reduce("+", {1, 2, 3}) == 6               |

## Now

Returns current timestamp.

### Definition

```
now()
```

### Example

The following expression results in `true`:

```
now() > timestamp("2015-06-24T17:35:50Z")
```

## Random

Returns a random number between 0 and 1.

### Definition

```
random()
```

## Size

Returns the length of a string or number of objects in a set.

### Definition

```
size(value)
```

| Argument | Type       |
| -------- | ---------- |
| value    | string set |

### Examples

All the following expressions result in `true`:

```
size("Recombee") == 8

size("") == 0

size({"abc", 4, {} } ) == 3

// Objects in nested set are not counted
size({ {1,2,3} } ) == 1
```

## Item Values

Returns property values of a particular item as a dictionary.

### Definition

```
item_values(item_id)
```

| Argument | Type   | Meaning       |
| -------- | ------ | ------------- |
| value    | string | ID of an item |

### Example

```
// Returns value of property "category" for item with ID "item-42"
item_values("item-42")["category"]
```

## Reduce

Reduces a set into a single value using an operator.

### Definition

```
reduce(operator, input_set, initial_value)
```

| Argument       | Type                               | Meaning                                                         |
| -------------- | ---------------------------------- | --------------------------------------------------------------- |
| operator       | string                             | One of +, \*, &, and, or                                        |
| input\_set     | set                                | Set that will be reduced                                        |
| initial\_value | Same type as members of input\_set | _Optional._ Value used as left operand for the first operation. |

### Example

All the following expressions result in `true`:

```
reduce("+", {2, 3, 4}) == 9

reduce("+", {2, 3, 4}, 1) == 10

reduce("*", {2, 3, 4}) == 24

reduce("and", {true, false, true}) == false

reduce("or", {true, false, true}) == true
```