Created
December 19, 2014 14:36
-
-
Save melkio/62ebea32020f2a6dc9e9 to your computer and use it in GitHub Desktop.
compute distance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(String[] args) | |
{ | |
var points = new[] { 1, 2, 3, 4, 5 }; | |
var distance = points | |
.Zip(points.Skip(1), Tuple.Create) | |
.Select(x => ComputeDistance(x.Item1, x.Item2)) | |
.Sum(); | |
} | |
static Int32 ComputeDistance(Int32 value1, Int32 value2) | |
{ | |
return new Random(DateTime.Now.Millisecond).Next(0, 100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment