<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # package rand `import "crypto/rand"` rand包實現了用于加解密的更安全的隨機數生成器。 ## Index * [Variables](#pkg-variables) * [func Int(rand io.Reader, max \*big.Int) (n \*big.Int, err error)](#Int) * [func Prime(rand io.Reader, bits int) (p \*big.Int, err error)](#Prime) * [func Read(b []byte) (n int, err error)](#Read) ### Examples * [Read](#example-Read) ## Variables ``` var Reader io.Reader ``` Reader是一個全局、共享的密碼用強隨機數生成器。在Unix類型系統中,會從/dev/urandom讀取;而Windows中會調用CryptGenRandom API。 ## func [Int](https://github.com/golang/go/blob/master/src/crypto/rand/util.go#L106 "View Source") ``` func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) ``` 返回一個在[0, max)區間服從均勻分布的隨機值,如果max&lt;=0則會panic。 ## func [Prime](https://github.com/golang/go/blob/master/src/crypto/rand/util.go#L31 "View Source") ``` func Prime(rand io.Reader, bits int) (p *big.Int, err error) ``` 返回一個具有指定字位數的數字,該數字具有很高可能性是質數。如果從rand讀取時出錯,或者bits&lt;2會返回錯誤。 ## func [Read](https://github.com/golang/go/blob/master/src/crypto/rand/rand.go#L19 "View Source") ``` func Read(b []byte) (n int, err error) ``` 本函數是一個使用io.ReadFull調用Reader.Read的輔助性函數。當且僅當err == nil時,返回值n == len(b)。 Example ``` c := 10 b := make([]byte, c) _, err := rand.Read(b) if err != nil { fmt.Println("error:", err) return } // The slice should now contain random bytes instead of only zeroes. fmt.Println(bytes.Equal(b, make([]byte, c))) ``` Output: ``` false ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看