Fix lagrange interpolation

fixes
add randomization of charsets
fix charset representation