golang-标准库(math/rand)

rand包是go提供用来产生各种各样随机数的包,本文对这些产生随机数的方法做一下介绍。注意:rand生成的数值虽然说是随机数,但它其实是伪随机数,关于为什么是伪随机数,而不是真正的随机数,本文不做详细讲解,因为我也不是太清楚,只是提出这一点;简单说一下我的理解:真正的随机数是无规则可循的,就像抛硬币,正反面是真正随机的,这是一个真正的随机案例。计算机底层生成一个数值,究其根源它也是程序员们根据某种算法得到的数值,而是要是人为操控的计算就一定有规律可循,只是这个规律不是肉眼可见的。所以说是伪随机数。

原文搬至:https://itpika.com/2019/07/09/go/library-math-rand

root@ubuntu:/home/uu/go/src/github.com/hyperledger/fabric-samples/test-network# sudo ./network.sh deployCC Using docker and docker-compose deploying chaincode on channel 'mychannel' executing with the following - CHANNEL_NAME: mychannel - CC_NAME: basic - CC_SRC_PATH: ../asset-transfer-basic/chaincode-go - CC_SRC_LANGUAGE: go - CC_VERSION: 1.0 - CC_SEQUENCE: auto - CC_END_POLICY: NA - CC_COLL_CONFIG: NA - CC_INIT_FCN: NA - DELAY: 3 - MAX_RETRY: 5 - VERBOSE: false executing with the following - CC_NAME: basic - CC_SRC_PATH: ../asset-transfer-basic/chaincode-go - CC_SRC_LANGUAGE: go - CC_VERSION: 1.0 Vendoring Go dependencies at ../asset-transfer-basic/chaincode-go /home/uu/go/src/github.com/hyperledger/fabric-samples/asset-transfer-basic/chaincode-go /home/uu/go/src/github.com/hyperledger/fabric-samples/test-network /home/uu/go/src/github.com/hyperledger/fabric-samples/test-network Finished vendoring Go dependencies + '[' false = true ']' + peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-go --lang golang --label basic_1.0 + res=0 Chaincode is packaged Installing chaincode on peer0.org1... Using organization 1 + jq -r 'try (.installed_chaincodes[].package_id)' + peer lifecycle chaincode queryinstalled --output json + grep '^Perform chaincode operations: package|install|queryinstalled|getinstalledpackage|approveformyorg|queryapproved|checkcommitreadiness|commit|querycommitted Usage: peer lifecycle chaincode [command] Available Commands: approveformyorg Approve the chaincode definition for my org. checkcommitreadiness Check whether a chaincode definition is ready to be committed on a channel. commit Commit the chaincode definition on the channel. getinstalledpackage Get an installed chaincode package from a peer. install Install a chaincode. package Package a chaincode queryapproved Query an org'\''s approved chaincode definition from its peer. querycommitted Query the committed chaincode definitions by channel on a peer. queryinstalled Query the installed chaincodes on a peer. Flags: --cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint --certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint --clientauth Use mutual TLS when communicating with the orderer endpoint --connTimeout duration Timeout for client to connect (default 3s) -h, --help help for chaincode --keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint -o, --orderer string Ordering service endpoint --ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer --tls Use TLS when communicating with the orderer endpoint --tlsHandshakeTimeShift duration The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint Use "peer lifecycle chaincode [command] --help" for more information about a command.$' + test 1 -ne 0 + peer lifecycle chaincode install basic.tar.gz + res=1 Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "vendor/google.golang.org/protobuf/internal/editiondefaults/defaults.go:9:8: cannot find package "." in: /chaincode/input/src/vendor/embed vendor/golang.org/x/net/http2/transport.go:19:2: cannot find package "." in: /chaincode/input/src/vendor/io/fs vendor/google.golang.org/grpc/stats/metrics.go:19:8: cannot find package "." in: /chaincode/input/src/vendor/maps vendor/google.golang.org/grpc/balancer/pickfirst/internal/internal.go:22:2: cannot find package "." in: /chaincode/input/src/vendor/math/rand/v2 vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go:33:2: cannot find package "." in: /chaincode/input/src/vendor/net/netip vendor/google.golang.org/grpc/clientconn.go:27:2: cannot find package "." in: /chaincode/input/src/vendor/slices " Chaincode installation on peer0.org1 has failed Deploying chaincode failed 发生了什么错误
最新发布
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值