# RandomTrackSelection.Factory

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/trackselection/RandomTrackSelection.java+class:androidx.media3.exoplayer.trackselection.RandomTrackSelection.Factory)

*** ** * ** ***

<br />

```
class RandomTrackSelection.Factory : ExoTrackSelection.Factory
```

<br />

*** ** * ** ***

Factory for `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/RandomTrackSelection` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/RandomTrackSelection.Factory#Factory()()` |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/RandomTrackSelection.Factory#Factory(int)(seed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection!>!` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/NullableType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/RandomTrackSelection.Factory#createTrackSelections(androidx.media3.exoplayer.trackselection.ExoTrackSelection.Definition[],androidx.media3.exoplayer.upstream.BandwidthMeter,androidx.media3.exoplayer.source.MediaSource.MediaPeriodId,androidx.media3.common.Timeline)( @https://developer.android.com/reference/kotlin/androidx/media3/common/util/NullableType definitions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/util/NullableType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Definition!>!, bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!, mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!, timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline! )` Creates track selections for the provided `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Definition`. |

## Public constructors

### Factory

```
Factory()
```

### Factory

```
Factory(seed: Int)
```

| Parameters |
|---|---|
| `seed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A seed for the `https://developer.android.com/reference/java/util/Random.html` instance used by the factory. |

## Public functions

### createTrackSelections

```
@NullableType
fun createTrackSelections(
    @NullableType definitions: Array<@NullableType ExoTrackSelection.Definition!>!,
    bandwidthMeter: BandwidthMeter!,
    mediaPeriodId: MediaSource.MediaPeriodId!,
    timeline: Timeline!
): Array<ExoTrackSelection!>!
```

Creates track selections for the provided `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Definition`.

Implementations that create at most one adaptive track selection may use `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/TrackSelectionUtil#createTrackSelectionsForDefinitions(androidx.media3.exoplayer.trackselection.ExoTrackSelection.Definition[],androidx.media3.exoplayer.trackselection.TrackSelectionUtil.AdaptiveTrackSelectionFactory)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/media3/common/util/NullableType definitions: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<@https://developer.android.com/reference/kotlin/androidx/media3/common/util/NullableType https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Definition!>!` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection.Definition` array. May include null values. |
| `bandwidthMeter: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter!` | A `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/upstream/BandwidthMeter` which can be used to select tracks. |
| `mediaPeriodId: https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId!` | The `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/source/MediaSource.MediaPeriodId` of the period for which tracks are to be selected. |
| `timeline: https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Timeline` holding the period for which tracks are to be selected. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/trackselection/ExoTrackSelection!>!` | The created selections. Must have the same length as `definitions` and may include null values. |