lib/libs.js
function random (o) {
                    if(typeof o === 'object') {
                        return o instanceof Array ?
                            o[Math.floor(Math.random() * o.length)] :
                            o[Object.keys(o)[Math.floor(Math.random() * Object.keys(o).length)]];
                    }
                    else if(typeof o === 'string' || typeof o === 'number') {
                        var val = o, negative = false;

                        if(o.length === 0) return '';
                        if(typeof o === 'number' && o < 0) {
                            negative = true;
                            val = Math.abs(val);
                        }

                        val = val.toString()[Math.floor(Math.random() * val.toString().length)];
                        if(typeof o === 'number') val = parseInt(val, 10);
                        return negative ? -val : val;
                    }
                    return o;
                }
function random (o) {
                    if(typeof o === 'object') {
                        return o instanceof Array ?
                            o[Math.floor(Math.random() * o.length)] :
                            o[Object.keys(o)[Math.floor(Math.random() * Object.keys(o).length)]];
                    }
                    else if(typeof o === 'string' || typeof o === 'number') {
                        var val = o, negative = false;

                        if(o.length === 0) return '';
                        if(typeof o === 'number' && o < 0) {
                            negative = true;
                            val = Math.abs(val);
                        }

                        val = val.toString()[Math.floor(Math.random() * val.toString().length)];
                        if(typeof o === 'number') val = parseInt(val, 10);
                        return negative ? -val : val;
                    }
                    return o;
                }
function random ( o ) { if ( typeof o === 'object' ) { return o instanceof Array ? o [ Math . floor ( Math . random ( ) * o . length ) ] : o [ Object . keys ( o ) [ Math . floor ( Math . random ( ) * Object . keys ( o ) . length ) ] ] ; } else if ( typeof o === 'string' || typeof o === 'number' ) { var val = o , negative = false ; if ( o . length === 0 ) return '' ; if ( typeof o === 'number' && o < 0 ) { negative = true ; val = Math . abs ( val ) ; } val = val . toString ( ) [ Math . floor ( Math . random ( ) * val . toString ( ) . length ) ] ; if ( typeof o === 'number' ) val = parseInt ( val , 10 ) ; return negative ? - val : val ; } return o ; }
Returns a random array item, random object property, random character in a string, or random digit in a number.
@param {Object} o The object to operate on.
@returns {*}
@function
Returns a random array item random object property random character in a string or random digit in a number .