Skip to content

Instantly share code, notes, and snippets.

@arindamroynitw
Last active September 15, 2019 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arindamroynitw/647d2656631e01b74d1cd12d6b56dd2a to your computer and use it in GitHub Desktop.
Save arindamroynitw/647d2656631e01b74d1cd12d6b56dd2a to your computer and use it in GitHub Desktop.
Serial Execution - Parallel Processing in Golang
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
list := []string{"a", "b", "c", "d", "e", "f", "g", "h"}
for i := 0; i < len(list); i++ {
d := time.Duration(rand.Intn(10)) * time.Microsecond
time.Sleep(d)
fmt.Printf("Current value is : %s \n", list[i])
}
fmt.Println("Program finished executing")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment