array#sample adapted from rubinius