Skip to content

Instantly share code, notes, and snippets.

View jobyid's full-sized avatar

Joby jobyid

View GitHub Profile
/**
*Submitted for verification at Etherscan.io on 2021-09-05
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// [MIT License]
/// @title Base64
@mattlockyer
mattlockyer / random.rs
Last active June 2, 2022 17:40
NEAR Random Number (u128)
// anywhere in your contract
fn random_u128() -> u128 {
let random_seed = env::random_seed(); // len 32
// using first 16 bytes (doesn't affect randomness)
as_u128(random_seed.get(..16).unwrap())
}
fn as_u128(arr: &[u8]) -> u128 {