How to generate testdata?

Hi All,
I am new to this forum. So I am going through the tutorials. One thing I am wondering, how do we create the test data? For example write an sorting algorithm to sort 10^10 salaries for XYZ company. How do I generate such many numbers? do we follow any automated tool/ code? Please help.

In this type of question, the input (the salaries in this case) is generally given, you just have to process those input values and generate the desired output. Besides, if you want to test your program before submitting, then you can write a program to generate that many random values and feed it to your program. In that case, you can use functions which generate random numbers (you may google it to find further information).

If I understood correctly, you’re talking about generating those 10^10 numbers in the first place as if you wanted to create a statement + test cases.

Generating 10^10 numbers is quite tedious as the range of numbers is huge and making 10^10 random() function calls, is not pratical, so, the best you can do is either get a better bound on the numbers (10^9 or 10^8 is still good enough to test for a sorting problem and it’s A LOT more manageable).

As far as I can remember and from all statements I’ve seen and written, I’ve never seen a problem like that needing such a higher limit on N.

Best,

Bruno

//