Last active
September 15, 2019 17:39
-
-
Save arindamroynitw/647d2656631e01b74d1cd12d6b56dd2a to your computer and use it in GitHub Desktop.
Serial Execution - Parallel Processing in Golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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