Created
February 20, 2012 14:21
-
-
Save biboudis/1869437 to your computer and use it in GitHub Desktop.
A random number, observable generator in Rx, without closing over a Random value.
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
IDisposable generator = Observable.Generate<Tuple<Random, int>, int>( | |
new Tuple<Random, int>(new Random(), 0), | |
value => value.Item2 < 100, | |
value => new Tuple<Random, int>(value.Item1, value.Item2 + 1), | |
value => value.Item1.Next(0, 100), scheduler).Subscribe(Console.WriteLine); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment