Skip to content

Instantly share code, notes, and snippets.

View TWolverson's full-sized avatar
🏠
Working from home

TWolverson

🏠
Working from home
View GitHub Profile
var sample = random.NextDouble(1);
var cumulative = 0.0;
var selectedItem = items.TakeWhile(item => {
cumulative += item.Probability; // probability is a ratio i.e. fraction of 1
return cumulative <= sample;
}).Last();
type node =
| A
| B
| Empty
| NotANode
let delta centre satellite =
// where delta and centre are identical, +1
// where delta and centre are A/B or B/A, -1
// any other combination, 0
class Program
{
static void Main(string[] args)
{
}
private IEnumerable<dynamic> Parse()
{
for (int i = 0; i < 10; i++)
{
public class Window {
public Window() {
_member = ServiceLocator.GetInstance<IMember>();
}
}
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program