Hello, I came across the same topic, it was very useful for me.
This is how I decided to implement it in ansible.
- name: "Generate a virtual ip address uniq id"
ansible.builtin.debug:
var: query('community.general.random_string', upper=false, special=false, min_numeric=10, min_lower=3, length=13)
# Example result: ['202121w730p1q']