Page 1 of 1

generate random characters

PostPosted: Wed Jun 04, 2014 6:35 pm
by ramu65
Hi

I have a requirement to generate random names and insert into table.Is it possible to achieve this in cobol??

Re: generate random characters

PostPosted: Wed Jun 04, 2014 7:05 pm
by BillyBoyo
It is not only possible, it is a common beginner's mistake in the early stages of testing.

However, you're going to have to explain a bit more about what you want to get a more serious answer.

Re: generate random characters

PostPosted: Fri Jun 06, 2014 8:36 pm
by Ed Goodman
Do they need to be legit names, like Carrie R Cards, or can they be actual random characters, like asjhkj sdsdlkiu?

Re: generate random characters

PostPosted: Sun Jun 08, 2014 8:18 pm
by ramu65
I know its difficult to produce legit names.My requirement is to just produce random strings of maximum 10 characters.I am not aware on how to convert random numbers to corresponding alphabets.Can someone please share code to implement the same.

Re: generate random characters

PostPosted: Sun Jun 08, 2014 9:59 pm
by enrico-sorichetti
iterate 10 times generating every time a number form 1 to the number of chars of Your destination alphabet
and use the number as the index for the char to use