Creating valid test numbers given a country code

470 views
Skip to first unread message

Robert DiFalco

unread,
Dec 16, 2014, 1:22:59 PM12/16/14
to libphonenum...@googlegroups.com
Is there a reliable way to generate random numbers with this library given a country code? I need parseable numbers for fake testing data. Thanks!

David Yonge-Mallo

unread,
Dec 17, 2014, 10:07:30 AM12/17/14
to libphonenum...@googlegroups.com

On Tuesday, December 16, 2014 7:22:59 PM UTC+1, Robert DiFalco wrote:
Is there a reliable way to generate random numbers with this library given a country code? I need parseable numbers for fake testing data. Thanks!

How "random" are we talking here, and how many distinct ones do you need? You can call getExampleNumber(), and if you need more than one example number, replace the last N digits. This should work in most places if N is small. 

Robert DiFalco

unread,
Dec 22, 2014, 8:37:36 PM12/22/14
to libphonenum...@googlegroups.com
Works perfectly thanks.
Reply all
Reply to author
Forward
0 new messages