// RunN runs the given f n times (and passes the run's index) and waits till they complete.
// It starts n-1 goroutines, and runs one instance in the current goroutine.
RunN runs the given f n times (and passes the run's index) and waits till they complete.
It starts n-1 goroutines, and runs one instance in the current goroutine.
// RunN runs the given f n times ( and passes the run ' s index ) and waits till they complete . // It starts n - 1 goroutines and runs one instance in the current goroutine .
func RunN(n int, f func(i int)) {
	var wg sync.WaitGroup
	for i := 0; i < n-1; i++ {
		wg.Add(1)
		go func(i int) {
			defer wg.Done()
			f(i)
		}(i)
	}
	f(n - 1)
	wg.Wait()
}
func RunN ( n int , f func ( i int ) ) { var wg sync . WaitGroup for i := 0 ; i < n - 1 ; i ++ { wg . Add ( 1 ) go func ( i int ) { defer wg . Done ( ) f ( i ) } ( i ) } f ( n - 1 ) wg . Wait ( ) }
RunN runs the given f n times (and passes the run's index) and waits till they complete.
RunN runs the given f n times ( and passes the run ' s index ) and waits till they complete .