ikerstges
15 years agoNew Contributor
Generate positive long integer?
Hi,
In some of my testcases, I need a random long integer. I've found these Groovy lines to provide me with such:
Random random = new Random();
long randomVal = random.nextLong();
Those two lines return positive AND negative values, but I'd need the number to be always positive.
Any tips or advise would be greatly appreciated!
In some of my testcases, I need a random long integer. I've found these Groovy lines to provide me with such:
Random random = new Random();
long randomVal = random.nextLong();
Those two lines return positive AND negative values, but I'd need the number to be always positive.
Any tips or advise would be greatly appreciated!