Open GoogleCodeExporter opened 9 years ago
Original comment by azizatif
on 4 Apr 2009 at 6:30
What about:
public static IEnumerable<TReturn> Infinity<TReturn>(TReturn start,
Func<TReturn, TReturn?> generator)
where TReturn : struct
{
generator.ThrowIfNull("generator");
TReturn? val = start;
while (val.HasValue)
{
yield return val.Value;
val = generator(val.Value);
}
}
public static IEnumerable<double> Noise(int seed)
{
Random r = new Random(seed);
return Infinity(r.NextDouble(), x => r.NextDouble());
}
Original comment by bruno.ac...@gmail.com
on 22 Oct 2011 at 4:02
mail me if you want the full implementation with testing
Original comment by bruno.ac...@gmail.com
on 22 Oct 2011 at 5:17
That's a pretty easy way of doing it, yes. Coming to think about it again after
these years, maybe it's a bit odd to have an infinite enumerable? I haven't
found other places in .NET where an enumerable sequence never end.
Original comment by l.jarven...@gmail.com
on 22 Oct 2011 at 11:15
This issue has been migrated to:
https://github.com/MoreLINQ/morelinq/issues/21
The conversation continues there.
DO NOT post any further comments to the issue tracker on Google Code as it is
shutting down.
You can also just subscribe to the issue on GitHub to receive notifications of
any further development.
Original comment by azizatif
on 21 Aug 2015 at 6:55
Original issue reported on code.google.com by
l.jarven...@gmail.com
on 25 Mar 2009 at 2:40