HN user

blameless

22 karma
Posts2
Comments7
View on HN

I've been using these for years in Visual Studio.

My most commonly used one is "prop" which generates an automatic property in C#: "public string Name { get; set; }". I type "prop", then hit tab, string is selected and I can change it to any type I want, hit tab again, I can now change the name of the property, hit enter and I'm done Takes 1.5 seconds.

I've been using Linode for years. I signed up when they offered free $100 credit. After my free year of Amazon AWS ran out, I went to Linode "until the $100 credit runs out". I ended up staying until this day.

I've been meaning to switch to DigitalOcean because it's twice as cheap but it's too much hassle to switch all domains, etc. so I've stuck with Linode.

I've never had to deal with Linode support which I guess is a good thing. DigitalOcean support is also great.

My credit card was stolen from Linode (I only ever used it to pay for Linode and Amazon). Luckily it was blocked by my bank automatically. Because of this, I will never call Linode rock-solid, secure or trusted.

I'm unable to reproduce the results. Balance is always negative. What's wrong with my code?

  // for a graph
  var balances = [];

  // constants
  var winnings =  1, 
      losses   = -1, 
      epsilon  = 0.05;

  function play(probOfWinning) {
      return Math.random() < probOfWinning ? winnings : losses;
  }

  for (var experiment = 0; experiment < 100; experiment++) {
      var balance = 0;
      for (var flip = 0; flip < 1000000; flip++) {
          if (flip % 3 == 0) { // game A
              balance += play(0.5 - epsilon);
          } else { // game B
              balance += Math.round(balance) % 3 == 0 ? play(1/10 - epsilon)
                                                      : play(3/4  - epsilon)
          }
      }
      balances.push(balance);
  }