util.tcl (redis-6.2-rc3) | : | util.tcl (redis-6.2.0) | ||
---|---|---|---|---|

skipping to change at line 684 | skipping to change at line 684 | |||

# TCL8.5 has issues mixing \x notation and normal chars in the same | # TCL8.5 has issues mixing \x notation and normal chars in the same | |||

# source code string, so we'll convert the entire string. | # source code string, so we'll convert the entire string. | |||

append res \\x[format %02X $int] | append res \\x[format %02X $int] | |||

} | } | |||

if {!$has_special_chars} { | if {!$has_special_chars} { | |||

return $s | return $s | |||

} | } | |||

set res "\"$res\"" | set res "\"$res\"" | |||

return $res | return $res | |||

} | } | |||

# Check that probability of each element are between {min_prop} and {max_prop}. | ||||

proc check_histogram_distribution {res min_prop max_prop} { | ||||

unset -nocomplain mydict | ||||

foreach key $res { | ||||

dict incr mydict $key 1 | ||||

} | ||||

foreach key [dict keys $mydict] { | ||||

set value [dict get $mydict $key] | ||||

set probability [expr {double($value) / [llength $res]}] | ||||

if {$probability < $min_prop || $probability > $max_prop} { | ||||

return false | ||||

} | ||||

} | ||||

return true | ||||

} | ||||

End of changes. 1 change blocks. | ||||

0 lines changed or deleted | | 0 lines changed or added |