You might check out

[link:lorgonblog.spaces.live.com]

which has code to shuffle an array (by mutating the array in-place). And

[link:lorgonblog.spaces.live.com]

has a function AllPermutations which generates a sequence of all permutations of an array.

See

[link:cs.hubfs.net]

for info on syntax coloring messages here.

By on 4/29/2009 5:45 PM ()

Thanks for the lightning fast answer!

Bruno

By on 4/29/2009 5:58 PM ()

You may want to check out FsCheck (fscheck.codeplex.com), it has a combinator library for generating random instances of some type. In your case, just

1
let gen = arbitrary<list<int>>

would give you a function

1
val gen : int -> int > list<int> 

where the first int is the random seed, the second int is the maximum size of the list.But probably it will be too slow for your purposes - performance is not that critical for testing applications.

By on 4/29/2009 11:51 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper