Skip to content

Instantly share code, notes, and snippets.

@mathiasbynens
mathiasbynens / deterministic-math-random.js
Last active May 16, 2024 12:37
Here’s a 100% deterministic (predictable) alternative to `Math.random`. Useful when benchmarking.
// Here’s a 100% deterministic alternative to `Math.random`. Google’s V8 and
// Octane benchmark suites use this to ensure predictable results.
Math.random = (function() {
var seed = 0x2F6E2B1;
return function() {
// Robert Jenkins’ 32 bit integer hash function
seed = ((seed + 0x7ED55D16) + (seed << 12)) & 0xFFFFFFFF;
seed = ((seed ^ 0xC761C23C) ^ (seed >>> 19)) & 0xFFFFFFFF;
seed = ((seed + 0x165667B1) + (seed << 5)) & 0xFFFFFFFF;
@ChenShiChao
ChenShiChao / Google Pay遇到的问题
Created January 11, 2016 06:07
Google Pay遇到的问题
1、需要验证身份.您需要登录自己google账号
上传到Alpha或者beta版本到google paly,同时记得要发布版本
2、无法购买您要买的商品
我们使用的封闭测试,此错误信息是测试者账号未加入测试账号中(需要google play把当前账号加入到测试账号中,记得google play需要选中),然后让google play端把测试地址给你,浏览器打开测试地址,点击确认自己加入测试账号即可;
3、此版本的应用未配置为通过google play 结算。有关详情,请访问帮助中心
APP打包签名证书不一致,需要确定测试的APP是否和google play的App证书是否一致,注意最好是从google play下载版本安装测试
@suzuke
suzuke / Möller–Trumbore_intersection_algorithm
Created September 12, 2018 02:21
Möller–Trumbore_intersection_algorithm with fixedpoint
//https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
private bool RayIntersectsTriangle(ISupportMappable support, ref TSMatrix orientation, ref TSMatrix invOrientation,
ref TSVector position, ref TSVector origin, ref TSVector direction, out FP fraction, out TSVector normal)
{
FP EPSILON = FP.EN8;
fraction = FP.Zero;
normal = TSVector.zero;
TriangleMeshShape inTriangle = support as TriangleMeshShape;
TSVector[] vertices = inTriangle.Vertices;