examples: add example to exercise random number generation
Signed-off-by: deadprogram <ron@hybridgroup.com>
Этот коммит содержится в:
родитель
75dfb26452
коммит
5159eab694
1 изменённых файлов: 17 добавлений и 0 удалений
17
src/examples/rand/main.go
Обычный файл
17
src/examples/rand/main.go
Обычный файл
|
@ -0,0 +1,17 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/rand"
|
||||||
|
"encoding/hex"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var result [32]byte
|
||||||
|
for {
|
||||||
|
rand.Read(result[:])
|
||||||
|
encodedString := hex.EncodeToString(result[:])
|
||||||
|
println(encodedString)
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Создание таблицы
Сослаться в новой задаче