|
-
Jan 3rd, 2015, 09:20 AM
#1
Thread Starter
New Member
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
-
Jan 3rd, 2015, 09:45 AM
#2
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.
-
Jan 3rd, 2015, 10:06 AM
#3
Thread Starter
New Member
Re: iterate each line with random range
 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.
-
Jan 3rd, 2015, 10:31 AM
#4
Re: iterate each line with random range
 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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|