Split the input using comma (,) as the field separator and set the output field separator to comma (,). For each field, remove leading and trailing whitespace and randomly convert the field to either upper or lower case. Print the result.
awk -F, -v OFS=',' '{for (i=1;i<=NF;i++) {sub(/^[ \t\r\n]+|[ \t\r\n]+$/,"",$i); $i=(rand()<0.5)?toupper($i):tolower($i)}; print}'