automatically set random featured image by category in wordpress on post

You should prepare an array of images ids for each category and pick one of them randomly. I say “one of them” since the featured image is always 1 if I understood well your question.. which is somehow ambiguous when you say set an image and later to have more than one feature image
So, editing part of your code and assuming that the rest is working:

//...
else if ( in_category('49') ) {
  // array of  ids of images for this category
  $arrImages = array(2200,2201,2202);

  // get random index from array $arrImages
  $randIndex = array_rand($arrImages);

  // output the value for the random index
  set_post_thumbnail($post->ID, $arrImages[$randIndex]);
  //wp_reset_postdata();

}
else if ( in_category('50') ) { // for example.. and so on
  $arrImages = array(2203,2204,2205);
  $randIndex = array_rand($arrImages);
  set_post_thumbnail($post->ID, $arrImages[$randIndex]);
}

wp_reset_postdata(); is not actually needed since you’re not altering the main query see wp_reset_postdata()