iterate each line with random range
i have two text file
one is a.txt and another is b.txt
content of a.txt is
a
b
c
d
content of b.txt is
1
2
3
4
5
6
7
8
9
i want to process each a.txt line to random range of b.txt lines.
for instance.
Code:
for each aa as String in a.txt
for bb as integer = 0 to b.txt.count - 1
end for
end for
so what i want to get result is like this one
each a.txt line to random range of b.txt lines
a12
b3456
c789
Re: iterate each line with random range
Create a Random object and then, each time you want a random number, call its Next method. It's the same regardless of what you intend to use the random number for. Of course, you're going to have to apply some appropriate limits or you'll get all lines in the second file associated with the first line in the first file more often than not. As for what those limits should be, that's nothing to do with programming because they would be the same as the limits you would use if you were doing the whole thing with pen and paper.
Re: iterate each line with random range
Quote:
Originally Posted by
jmcilhinney
Create a Random object and then, each time you want a random number, call its Next method. It's the same regardless of what you intend to use the random number for. Of course, you're going to have to apply some appropriate limits or you'll get all lines in the second file associated with the first line in the first file more often than not. As for what those limits should be, that's nothing to do with programming because they would be the same as the limits you would use if you were doing the whole thing with pen and paper.
if you give me some more specific snippet or reference it would be very helpful for me.
Re: iterate each line with random range
Quote:
Originally Posted by
james27
if you give me some more specific snippet or reference it would be very helpful for me.
Why exactly a hopeful programmer needs to be shown how to do a web search, I'm not sure, but here's your reference anyway:
http://lmgtfy.com/?q=vb.net+random+class