title: How to write the output of this statement into a file in Golang
body: <p>I'm trying to write the output of the statement below into a text file but I can't seem to find out if there is a printf function that writes directly to a text file. For example if the code below produces the results [5 1 2 4 0 3] I would want to read this into a text file for storage and persistence. Any ideas please?</p>
  
  <p>The code I want to goto the text file:</p>
  
  <pre><code>//choose random number for recipe
  r := rand.New(rand.NewSource(time.Now().UnixNano()))
  i := r.Perm(5)
  fmt.Printf("%v\n", i)
  fmt.Printf("%d\n", i[0])
  fmt.Printf("%d\n", i[1])
  </code></pre>