# tf_privacy.tree_aggregation.ValueGenerator

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L35-L62) |

Base class establishing interface for stateful value generation.

A `ValueGenerator` maintains a state, and each time `next` is called, a new
value is generated and the state is advanced.

## Methods

### `initialize`

[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L42-L49)

    @abc.abstractmethod
    initialize()

Makes an initialized state for the ValueGenerator.

<br />

<br />

<br />

| Returns ||
|---|---|
| An initial state. ||

<br />

### `next`

[View source](https://github.com/tensorflow/privacy/blob/v0.9.0/privacy/privacy/dp_query/tree_aggregation.py#L51-L62)

    @abc.abstractmethod
    next(
        state
    )

Gets next value and advances the ValueGenerator.

<br />

<br />

<br />

| Args ||
|---|---|
| `state` | The current state. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A pair (value, new_state) where value is the next value and new_state is the advanced state. ||

<br />