Hello

by Wow on December 21st, 2009
No notes
Syntax: C++
Show lines - Hide lines - Show in textbox - Download
	private: System::String^ getRandomString() {
				 String^ s = "";
				 Random^ r = gcnew Random((int)DateTime::Now.Ticks);
				 // 產生一組五字元的String
				 for (int i = 0; i < 5; i++) {
					 // 決定大小寫
					 if (r->Next() % 2 == 0) {
						 s += Char('a' + r->Next(26)).ToString();
					 }
					 else {
						 s += Char('A' + r->Next(26)).ToString();
					 }
				 }
				 System::Threading::Thread::Sleep(10);
				 return s;
			 }
 
	private: System::Void generateRandText(array<wordSet^>^ ws) {
				 try {
					 for (int i = 0; i < 5; i++) {
						 ws[i]->text = this->getRandomString();
						 ws[i]->isTyped = false;
					 }	
				 }
				 catch (Exception^ e) {
					 this->addEvent(e->ToString());
				 }
			 }

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS