package com.google.android.gms.internal.ads;

import java.util.Random;

/* JADX INFO: loaded from: classes2.dex */
public final class ye1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final long f18818a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final long f18819b;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final i8.c f18823f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public long f18824g;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public long f18821d = 5;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public long f18822e = 0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Random f18825h = new Random();

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public long f18820c = 0;

    public ye1(long j10, long j11, i8.c cVar) {
        this.f18818a = j10;
        this.f18819b = j11;
        this.f18823f = cVar;
        a();
    }

    public final void a() {
        this.f18824g = this.f18818a;
        this.f18820c = 0L;
        this.f18822e = 0L;
    }

    public final long b() {
        double d10 = this.f18824g;
        double d11 = 0.2d * d10;
        long j10 = (long) (d10 + d11);
        return ((long) (d10 - d11)) + ((long) (this.f18825h.nextDouble() * ((j10 - r0) + 1)));
    }

    public final void c() {
        long jB = b();
        ((i8.d) this.f18823f).getClass();
        this.f18822e = System.currentTimeMillis() + jB;
        double d10 = this.f18824g;
        this.f18824g = Math.min((long) (d10 + d10), this.f18819b);
        this.f18820c++;
    }

    public final boolean d() {
        tn tnVar = ao.J;
        n7.y yVar = n7.y.f31093e;
        return ((Integer) yVar.f31096c.b(tnVar)).intValue() >= 0 && this.f18820c > Math.max(this.f18821d, (long) ((Integer) yVar.f31096c.b(tnVar)).intValue()) && this.f18824g >= this.f18819b;
    }
}
