I have the code wrong obviously but I am trying to figure out how to get two groups of words to randomly join and print out into a richtextbox. Can anyone show me the code of what I need to perform exactly?
I am totally new and this is just me putting things together from different references of different projects that would seem to make sense. For some reason no one has really made a simple tutorial of how to perform this simple function. I would really appreciate
if someone could write out the code for me so I can learn from it that way.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String[] nouns = "Man Woman Animal World".Split(' ');
String[] adjs = "Funny Sleepy Boring Exciting".Split(' ');
var rand = new Random();
var noun = nouns[rand.Next(0, 3)];
var adj = adjs[rand.Next(0, 9)];
for (int i = 0; i < nouns.Length + adjs.Length; i++) ;
richTextBox1.AppendText(string.Join(" ", nouns, adjs));
}
}
}