How does hyperledger fabric handle random number generation? Given that one can write chaincode in JavaScript or Go and freely call random methods provided by the language libraries, how does the network handle the randomness?
Hyperledger fabric works in the order of Execute Order and Validate.So Execution steps is done in Endorser so execution is done with endorsement policy which is defined and it also removes randomization to avoid statelessness. 

Next the Ordering of transaction is done with the help of Orderer.

Finally Validation is done with the committer to avoid double spending.This is basically to check the integrity of the transaction.