The random number generation for hive-engine is defined here:
https://github.com/hive-engine/steemsmartcontracts/blob/hive-engine/libs/SmartContracts.js#L134
const rng = seedrandom(`${prevRefHiveBlockId}${refHiveBlockId}${transactionId}`);
the random number function is using rng:
https://github.com/hive-engine/steemsmartcontracts/blob/hive-engine/libs/SmartContracts.js#L180
The mining source code can be found here:
https://github.com/hive-engine/steemsmartcontracts/blob/hive-engine/contracts/mining.js
RE: Why was LeoFinance Down For So Long? + miner attack vector