Skip to content

Instantly share code, notes, and snippets.

@jageall
Created December 11, 2013 08:10
Show Gist options
  • Save jageall/7906685 to your computer and use it in GitHub Desktop.
Save jageall/7906685 to your computer and use it in GitHub Desktop.
Randomish chat message generator
using System;
using Newtonsoft.Json.Linq;
namespace ConsoleApplication3 {
class Program {
static void Main(string[] args) {
Random rnd = new Random();
var names = new[] {"James", "Greg", "Tomas", "Rob", "Matias", "Roberto", "Ronan"};
var text = new[] {"Hi","herpy", "derpy", "herpherp", "derpderp", "chocolate", "moose", "put the moose in the chocolate", "ponies", "starbucks", "happy"};
JArray events = new JArray();
for (int i = 0; i < 30; i++)
{
var @event = new
{
eventId = Guid.NewGuid(),
eventType = "ChatMessage",
data = new
{
sender = names[rnd.Next(names.Length)],
message = text[rnd.Next(text.Length)],
time = new TimeSpan(3, 45, 30).Add(TimeSpan.FromSeconds(i))
}
};
events.Add(JObject.FromObject(@event));
}
Console.WriteLine(@events);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment