Tim Cooke wrote:Does it matter? If the purpose of the function is to generate a random number, why is it important that the VBA version and the Java version generate the same number?
J. Kevin Robbins wrote:I'll admit I've only had one cup of coffee, so maybe I'm missing something here. Why not generate the list of random numbers from VB into a file as Piet suggested, then create your own Random class that reads that file and returns a number from the list?
Yes it would require creating a new class for testing purposes, but the changes to your production code would be minimal.
Dave Tolls wrote:
The problem there is how do you run those values through the VBA code so you can compare the results?
I'm guessing the VBA stuff has not been written with this in mind.
jacques dusieur wrote:I have large VBA macros that use Rnd() method.
I have to port this code in Java, I use here java.util.Random
Now I would like to check it does the exact same thing and of course random numbers seem to prevent that check.
I was wondering how I could manage to generate the same random values in VBA and in Java ?
Can I put a seed? Point to a common Random function (via a third-party library ?
jacques dusieur wrote:I have found a way to generate the same VBA Random sequence.