Hmmm, sounds like a homework assignment:)
It is fairly simple to accomplish though. I'm assuming your two lists have the values preset. So you just need to find the selected item of each list, convert to integer and multiply them.
Once you have that value a loop that includes that value as the maximum can be done that calculates a new random number each iteration of the loop.
Have a go and post up some code when you get stuck.
hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 167
What is the actual problem?
So far, it's just multiplication to get a result, right?
using System;
using System.Collections.Generic;
namespace DW_405186_CS_CON
{
class Program
{
static void Main(string[] args)
{
List<int> lst_intSeed1 = new List<int>() { 5, 1, 3, 2, 4 };
List<int> lst_intSeed2 = new List<int>() { 4, 1, 7 };
lst_intSeed1.ForEach(i =>
lst_intSeed2.ForEach(j =>
{
Console.WriteLine("{0} * {1} = {2}", i, j, (i * j));
}));
}
}
}
...and then the "overkill"
using System;
using System.Collections.Generic;
using System.Linq;
namespace DW_405186_CS_CON
{
class Program
{
static void Main(string[] args)
{
List<int> lst_intSeed1 = new List<int>() { 5, 1, 3, 2, 4 };
List<int> lst_intSeed2 = new List<int>() { 4, 1, 7 };
lst_intSeed1.ForEach(i =>
lst_intSeed2.ForEach(j =>
{
Console.Write("{0} * {1} = {2}:\n [ ", i, j, (i * j));
Random rnd = new Random((int)DateTime.Now.Ticks % int.MaxValue);
Enumerable.Range(1, (i * j)).ToList().ForEach(e => Console.Write("{0} ", rnd.Next(1, 100)));
Console.WriteLine(']');
}));
}
}
}
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
My lists are doubles not ints
I'm confused. Just change them to doublesand i have not tried to use an array. maybe i should.
What do you mean? What's wrong with a list?
It will only get more complicated with an array (or two).
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402