Random() function request

Topics: Extensions
Nov 30, 2009 at 5:34 AM

I always add this function to JSLINQ:

Random: function() {
            var len = this.items.length;
            var index = parseInt((Math.random() * len));
            return this.items[index];
        }

 

I think it might be useful in many scenarios and it can be added to the official version of JSLINQ.

 

Thanks!

Coordinator
Oct 25, 2010 at 2:08 PM

Thanks for the suggestion. A ".Random" method has been implemented in the code, and will be in the next update release.

http://jslinq.codeplex.com/workitem/7419