Still not sure if I really got what you are doing with the checkboxes XD I assume you select from all the page’s images the ones that should be used as potential background images. And from them you want to have one randomly displayed:
<?php $backgrounds = $page->background()->split(','); ?>
<?php $bg_key = array_rand($backgrounds); ?>
<?php if($image = $page->image($backgrounds[$bg_key])): ?>
background: url(<?php echo thumb($image)->url(); ?>);
<?php else: ?>
background: url('../../assets/img/background.jpg');
<?php endif; ?>