You can use a closure for that together with the use
keyword. Simple example:
$dynamic_value = 4;
add_shortcode( 'shortcodename',
function( $attributes, $content, $shortcode_name ) use $dynamic_value
{
return $dynamic_value;
}
);
See also Passing a parameter to filter and action functions.