Skip to content

Instantly share code, notes, and snippets.

@JasonGoemaat
JasonGoemaat / OpenSimplexNoise.cs
Created July 14, 2023 19:45 — forked from digitalshadow/OpenSimplexNoise.cs
OpenSimplex Noise Refactored for C#
/* OpenSimplex Noise in C#
* Ported from https://gist.github.com/KdotJPG/b1270127455a94ac5d19
* and heavily refactored to improve performance. */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace NoiseTest

Split the example. Say you are conducting an experiment and your friend walks in in the middle of it. Explain the setup (bag of 10 coins, 9 are fair and 1 has two heads) and that you've taken one coin at random from the bag. Ask what the odds are that heads will come up if you toss it. The answer is what your friend gave: $(\frac{9}{10})(\frac{1}{2}) + (\frac{1}{10})(1)$ = $\frac{11}{20}$

Now ask what the odds are if you tell him that you've already tossed the coin once? If he's smart, he'll ask you what the result of the toss was. If you answer 'tails', would that affect the odds of the next toss of that coin being heads? Yes, with the new information you know that the coin is one of the 9 fair coins so the probability is now $\frac{1}{2}$. He's right that it would not be $\frac{1}{4}$ for getting two heads in a row because each toss is independent, but you know it cannot be the double-headed coin so the odds change from $\frac{11}{20}$ to $\frac{1}{2}$.

The odds change if you know what coin

@JasonGoemaat
JasonGoemaat / Address.lua
Last active May 28, 2018 03:47
Address class for Cheat Engine LUA
local Address = {}
--[[ Return either a number or null for an address. If the address is
already a number, return it. If a string, do a symbol lookup.
--]]
local ValueToNumber = function(value)
if type(value) == 'string' then value = getAddressSafe(value) end
if type(value) ~= 'number' then return nil end
return value
end
@JasonGoemaat
JasonGoemaat / Console Log
Last active April 20, 2018 02:16
Nativescript Logs
Adding to process.env:
{ NVM_CD_FLAGS: '',
SHELL: '/bin/bash',
TMPDIR: '/var/folders/03/p0hccj8j2v98y9s1m8vwjzyc0000gn/T/',
Apple_PubSub_Socket_Render: '/private/tmp/com.apple.launchd.mOTuyk12BA/Render',
NVM_DIR: '/Users/jason/.nvm',
USER: 'jason',
SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.EwYLEXVsqn/Listeners',
__CF_USER_TEXT_ENCODING: '0x1F5:0x0:0x0',
GOOGLE_API_KEY: 'AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q',
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
"app": ["./src/scripts", "./src/main.ts"]
},
output: { path: './dist', filename: 'app.bundle.js' },
module: {
@JasonGoemaat
JasonGoemaat / 0_reuse_code.js
Created April 26, 2016 18:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console