来源(null)

package main

import crand "crypto/rand"
import (
	"io"
	"fmt"
	"encoding/base64"
)

func init() {
	println ("init()");
}

func GetRandData(length int) string {
	r := make([]byte, length)
	if _, err := io.ReadFull(crand.Reader, r); err != nil {
		panic("error reading from random source: " + err.Error())
	}
	return base64.URLEncoding.EncodeToString(r)
}

func main() {

	println ("main()");

	for i := 0; i < 10; i++ {
		randStr := GetRandData(32);
		fmt.Println(randStr)
	}
}

/**

init()
main()
ms6onbduxtzMsyD43dvvlLP2aEGcOMQEHcmfDNeB03s=
U63qvpdXhGZc73NmVa0oLmp4YlP8YiV09WH0qJxQOq0=
GmRzNtksckC5CNAu9JmHhQGYYxOZzSUKtDmxYGzfSDM=
-ieVj971_W8J_vmSqh3RpvDxpKlthj_JuDea65XhzY4=
pp7MbBEjZ7rwdaEXsURtTbKKCzyNDmKIVgHpEenFy-I=
u081uDZoeXQtx_bqkFak8XCltYRLMeOy_8OIbzS3jO4=
C71v_OxmZIUEFEMm2Y90NMshehExFo1douefFESPKBY=
8aUDIi0Dr85ofM0wgnz7WxbWNmRWoygWLymxH8QbBi8=
DNcV-vywE5JAAwEkfpf0K026fnmDDUxPfRhPzY8caSk=
KAcN09F8qhFPbC46QLZ2CU1AP7f9I9yVf5Y4xQjk6zs=

*/

Link: http://www.asm32.net/article_details.aspx?id=7355