def getRandomDeliveryAttachment(Integer probability = 25) { def deliveryImages = [ 'https://media.giphy.com/media/UtM8DmnahknE4/giphy.gif', 'https://media.giphy.com/media/11VKF3OwuGHzNe/giphy.gif', 'https://media.giphy.com/media/d5pGYhWb3T1Hyyl8OB/giphy.gif', 'https://media.giphy.com/media/oTSy3rHigPd9S/giphy.gif', 'https://media.giphy.com/media/9DgxhWOxHDHtF8bvwl/giphy.gif', 'https://media.giphy.com/media/9DgxhWOxHDHtF8bvwl/giphy.gif', 'https://media.giphy.com/media/1g2JyW7p6mtZc6bOEY/giphy.gif', 'https://media.giphy.com/media/7AqsdBK15kiOc/giphy.gif', 'https://media.giphy.com/media/r2MkQEOe7niGk/giphy.gif', 'https://media.giphy.com/media/ekXyB3lQ0IYL3luIFn/giphy.gif', 'https://media.giphy.com/media/QBRlXHKV5mpbLJ4prc/giphy.gif', 'https://media.giphy.com/media/NOsfNQGivMFry/giphy.gif', 'https://media.giphy.com/media/M1vu1FJnW6gms/giphy.gif', ] Random rnd = new Random() if (rnd.nextInt(100) > probability) { return []; } def imageUrl = deliveryImages[rnd.nextInt(deliveryImages.size())] return [[title: '', imageUrl: imageUrl]]; }