+function newJoin($u, $g)
+{
+ global $userprefix;
+ global $groupprefix;
+
+ $userNumber = rand(0, $u - 1);
+
+ $userNick = sprintf('%s%d', $userprefix, $userNumber);
+
+ $user = User::getKV('nickname', $userNick);
+
+ if (empty($user)) {
+ throw new Exception("Can't find user '$fromnick'.");
+ }
+
+ $groupNumber = rand(0, $g - 1);
+
+ $groupNick = sprintf('%s%d', $groupprefix, $groupNumber);
+
+ $group = User_group::getKV('nickname', $groupNick);
+
+ if (empty($group)) {
+ throw new Exception("Can't find group '$groupNick'.");
+ }
+
+ if (!$user->isMember($group)) {
+ $user->joinGroup($group);
+ }
+}
+
+/* Plugins should be part of the simulation too!
+function newFave($u)
+{
+ global $userprefix;
+ global $groupprefix;
+
+ $userNumber = rand(0, $u - 1);
+
+ $userNick = sprintf('%s%d', $userprefix, $userNumber);
+
+ $user = User::getKV('nickname', $userNick);
+
+ if (empty($user)) {
+ throw new Exception("Can't find user '$userNick'.");
+ }
+
+ // NB: it's OK to like your own stuff!
+
+ $otherNumber = rand(0, $u - 1);
+
+ $otherNick = sprintf('%s%d', $userprefix, $otherNumber);
+
+ $other = User::getKV('nickname', $otherNick);
+
+ if (empty($other)) {
+ throw new Exception("Can't find user '$otherNick'.");
+ }
+
+ $notices = $other->getNotices()->fetchAll();
+
+ if (count($notices) == 0) {
+ return;
+ }
+
+ $idx = rand(0, count($notices) - 1);
+
+ $notice = $notices[$idx];
+
+ if ($user->hasFave($notice)) {
+ return;
+ }
+
+ Fave::addNew($user->getProfile(), $notice);
+}*/
+
+function testNoticeContent()
+{
+ global $words;
+
+ if (is_null($words)) {
+ return "test notice content";
+ }
+
+ $cnt = rand(3, 8);
+
+ $ids = array_rand($words, $cnt);
+
+ foreach ($ids as $id) {
+ $parts[] = $words[$id];
+ }
+
+ $text = implode(' ', $parts);
+
+ if (mb_strlen($text) > 80) {
+ $text = substr($text, 0, 77) . "...";
+ }
+
+ return $text;
+}
+
+//function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax)
+function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax)