github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/crypto/rand/util.go (about) 1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package rand 6 7 import ( 8 "github.com/shogo82148/std/io" 9 "github.com/shogo82148/std/math/big" 10 ) 11 12 // Prime は与えられたビット長の数が高確率で素数である場合に返します。 13 // Prime は [rand.Read] によって返されるエラーまたは bits < 2 の場合にはエラーを返します。 14 func Prime(rand io.Reader, bits int) (*big.Int, error) 15 16 // Intは[0、max)の一様乱数を返します。max <= 0の場合、パニックを発生させます。 17 func Int(rand io.Reader, max *big.Int) (n *big.Int, err error)