All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.sdk.internal.AndroidFriendlyRandomHolder Maven / Gradle / Ivy

The newest version!
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.sdk.internal;

import java.util.Random;
import java.util.function.Supplier;

/**
 * {@link RandomSupplier} instance that doesn't use {@link java.util.concurrent.ThreadLocalRandom},
 * which is broken on most versions of Android (it uses the same seed everytime it starts up).
 */
enum AndroidFriendlyRandomHolder implements Supplier {
  INSTANCE;

  private static final Random random = new Random();

  @Override
  public Random get() {
    return random;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy