# tfg.geometry.representation.mesh.sampler.generate_random_face_indices

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/graphics/blob/master/tensorflow_graphics/geometry/representation/mesh/sampler.py#L143-L189) |

Generate a sample of face ids given per face probability.

    tfg.geometry.representation.mesh.sampler.generate_random_face_indices(
        num_samples: int,
        face_weights: type_alias.TensorLike,
        seed: Optional[type_alias.TensorLike] = None,
        stateless: bool = False,
        name: str = 'generate_random_face_indices'
    ) -> type_alias.TensorLike

<br />

<br />

<br />

| ## Note ||
|---|---|
| In the following, A1 to An are optional batch dimensions. ||

<br />

<br />

<br />

<br />

| ## Args ||
|---|---|
| `num_samples` | An `int32` scalar denoting the number of samples to generate per mesh. |
| `face_weights` | A `float` tensor of shape `[A1, ..., An, F]` where F is number of faces. All weights must be \> 0. |
| `seed` | Optional seed for the random number generator. |
| `stateless` | Optional flag to use stateless random sampler. If stateless=True, then `seed` must be provided as shape `[2]` int tensor. Stateless random sampling is useful for testing to generate the same reproducible sequence across calls. If stateless=False, then a stateful random number generator is used (default behavior). |
| `name` | Name for op. Defaults to "generate_random_face_indices". |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An `int32` tensor of shape `[A1, ..., An, num_samples]` denoting sampled face indices. ||

<br />