• [^] # Re: Mux & co

    Posté par (site web personnel) . En réponse au lien Go 1.22. Évalué à 1. Dernière modification le 08 février 2024 à 08:31.

    Inutile, je ne sais pas, tu peux avoir besoin de faire N fois une même chose, l'exemple du package benchmark :

    func BenchmarkRandInt(b *testing.B) {
     for i := 0; i < b.N; i++ {
     rand.Int()
     }
    }
    

    devient

    func BenchmarkRandInt(b *testing.B) {
     for range b.N {
     rand.Int()
     }
    }