I want to randomly assign a 4-digit ID to every respondent with no repeats. | XM Community
Skip to main content
Solved

I want to randomly assign a 4-digit ID to every respondent with no repeats.

  • November 11, 2017
  • 4 replies
  • 148 views

Poppy
Qualtrics Employee
  • Qualtrics Employee
  • 24 replies
I want to randomly assign a 4-digit ID to every respondent with no repeats (we anticipate ~500 responses). How could I set this up?

Best answer by JulieT

Unfortunately, the random number generator ${rand://int/1000:9999} cannot guarantee no repeats. You'd have to set up a web service to a designated URL. (And your license would have to have API access) I've been searching for a Web Service to no avail. If anyone can suggest one, I'd appreciate it! So need this!

4 replies

JulieT
Level 3 ●●●
Forum|alt.badge.img+10
  • Level 3 ●●●
  • 72 replies
  • Answer
  • November 14, 2017
Unfortunately, the random number generator ${rand://int/1000:9999} cannot guarantee no repeats. You'd have to set up a web service to a designated URL. (And your license would have to have API access) I've been searching for a Web Service to no avail. If anyone can suggest one, I'd appreciate it! So need this!

Michael_Campbell_RedPepper
QPN Level 3 ●●●
Forum|alt.badge.img+3
One thing I would use is a library that generates IDS. I have been using short-unique-id (https://www.npmjs.com/package/short-unique-id) for my surveys to put them in Batches. I haven't thoroughly tested its abilities to create 100% unique ID's every time, and so I might look for a better library if you absolutely have to make sure they're unique. I trust it, but don't take my word for it. This library is hosted via a pseudo CDN (Raw Git) so you can test it, but if you do use it, I would include the script in your project's code for safety.

AnthonyR
Level 4 ●●●●
Forum|alt.badge.img+7
  • Level 4 ●●●●
  • 308 replies
  • March 6, 2018
A web service would be the best way to guarantee uniqueness.

Michael_Campbell_RedPepper
QPN Level 3 ●●●
Forum|alt.badge.img+3
In a past project, I knew of someone who used https://www.random.org/integer-sets/, which uses Atmospheric Noise to generate random numbers. It's way over the top, but I thought it was pretty cool!