This file contains hidden or 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
| let (|Even|Odd|) x = | |
| if x % 2 = 0 then Even | |
| else Odd | |
| let median input = | |
| let sortedInput = input |> Seq.sort | |
| let length = input |> Seq.length | |
| match length with | |
| | 0 -> raise <| new ArgumentException("Input sequence is empty") | |
| | 1 -> input |> Seq.nth 0 |
This file contains hidden or 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
| let average input = | |
| let length = input |> Seq.length | |
| match length with | |
| | 0 -> raise <| new ArgumentException("Input sequence is empty") | |
| | _ -> (input |> Seq.sum) / float length | |
| // Average = 45.625 | |
| // (18 + 21 + 41 + 42 + 48 + 50 + 55 + 90) / 8 |
This file contains hidden or 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
| let responseTimes = [ 18.0; 21.0; 41.0; 42.0; 48.0; 50.0; 55.0; 90.0; ] |
This file contains hidden or 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
| A First Course in Probability | |
| http://www.amazon.com/First-Course-Probability-9th-Edition/dp/032179477X | |
| Probability Theory: The Logic of Science | |
| http://www.amazon.com/Probability-Theory-The-Logic-Science/dp/0521592712 | |
| Probability for Statistics and Machine Learning: Fundamentals and Advanced Topics | |
| http://www.amazon.com/Probability-Statistics-Machine-Learning-Fundamentals/dp/B00E6TK8P8/ref=sr_1_2?s=books&ie=UTF8&qid=1420291747&sr=1-2&keywords=Probability+for+Statistics+and+Machine+Learning%3A+Fundamentals+and+Advanced+Topics |
This file contains hidden or 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
| new CommandProjection("CasinoClerkReferralsProjection", _bus) | |
| .FromEvents((eventId) => _store.GetEvents(eventId)) | |
| .When<CashUserRegisteredInCasino>(e => new AwardReferralFee(x, y, z)) | |
| .Run(); |
This file contains hidden or 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
| Results seq [(Miss3, 37501); (Miss2, 49901); (Win, 12598)] |
This file contains hidden or 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
| let physicalWheel = [Miss1; Miss2; Win; Miss3] |> Seq.ofList | |
| let virtualWheel = [1; 1; 1; 1; 2; 3; 3; 3] |> Seq.ofList |
This file contains hidden or 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
| type WheelSpaceLabel = | |
| | Miss1 | |
| | Miss2 | |
| | Miss3 | |
| | Win |
This file contains hidden or 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
| seq [(Miss, 856903); (Win, 143097)] |
This file contains hidden or 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
| let rng = new Random() | |
| let random (rng : Random) virtualIndexes = | |
| virtualIndexes |> Seq.nth (rng.Next(0, virtualIndexes |> Seq.length)) | |
| let spin physicalWheel virtualIndexes rng = | |
| physicalWheel |> Seq.nth (random rng virtualIndexes) |