Macro Question 1.21.4

so I am trying to store a /random command, and use the stored result in a function. the first commands are:

tellraw @s {"text": "Or 50-150 gold","color": "gold","clickEvent": {"action": "run_command","value": "/function dnd:create_character/inventory/gold with storage sgold start"}}``` and in said function there is this:```$give @s bundle[bundle_contents=[{id:"gold_ingot",count:$(gold),components:{custom_name:'{"text": "Gold Piece","color": "#e0f206"}'}}]]``` ping with response.
Continue to help post