Map values extensions: set and compare

Tried to set current map values to new but didn’t found a method. All I got is val can't be set. So, it took 2 methods to do the thing:

        map.putAll(map.mapValues {
            Random.nextInt(1, 10)

The next case is to compare 2 values of the same map. There is no method, need to make an extension for it like

map.compareValues(key1, key2)
fun <T> MutableMap<T, Int>.compare(key1: T, key2: T) = compareValues(this[key1], this[key2])