Xpubs do not create random addresses. They are part of the Hierarchal Deterministic wallet structure.
Coinbin uses his own library or wrapper so it may not work as you expect when trying to hack it. To me it looks like you are feeding an xpub into a public key to address conversion which isn't how an extended public key (xpub) is used.
An HD derivation path looks like m/84'/0'/0'/0 for BIP84 bech32 addresses. The example code in your question does not contain any derivation path instructions, so you will always create the same address.
In order to deterministically create from an extended public key you need to specify which change and index you are using in the derivation path which is the last two numbers in the path: m/84'/0'/0'/0. The m/84'/0' portion of the derivation path is already encoded in your xpub/zpub.
The derivation path for the first address in the keychain would be: m/84'/0'/0'/0
The derivation path for the second address in the keychain would be: m/84'/0'/0'/1
The derivation path for the first change address: m/84'/0'/1'/0 ...
and so on.
Although using a different library deriving from an xpub should look something more like the below (source) where derivation path parameters are needed:
Note the last two parameters of the fromXpub function communicates which change and index from the derivation path we want, in this case the first address in the keychain.
Also just as a warning, do not generate "random" derivation indexes. HD wallets have look-ahead gaps which can only see about 20 address ahead, sending funds to m/84'/0'/34'/251 for example could possibly never be found by a wallet unless you had a custom wallet that knew to look there.