how to make a random text generator/ swift Xcode 6

I would like to make a random text generator but there are no videos on youtube about it, i can only find random number generator. Can someone please tell me which codes i have to use to make the random text generator.

Replies

You need to be more specific about what kind of text you want generated. Is it just a string of random characters? Special characters like question marks, colons, ampersands, etc, or only A-Z? Full Unicode? Or random words? How long is the output supposed to be?

i want to generate random words e.g. Place,Cat,House and the output is to last 60 seconds

You still need to be a lot more specific as to what it is that you want to do.

This command line OS X app does what you ask for, but I doubt that it's what you really want:

import Cocoa

let words = ["Place", "Cat", "House"]

let endTime = CACurrentMediaTime() + 60.0
while CACurrentMediaTime() <= endTime {
    print(words[Int(arc4random_uniform(UInt32(words.count)))])
}

class ViewController: UIViewController

{

@IBOutlet var timer:UILabel?

@IBOutlet var score:UILabel?

@IBOutlet var button:UIButton?

@IBOutlet var RandomText:UILabel?

var thescore = Int()

var time = Int()

var thetimer = NSTimer()

var Randomtext = random()


override func viewDidLoad() {

super.viewDidLoad()

self.startgame()


@IBAction func Randomtext ->(id); sendtext ---------->>>>> Creating this function is my problem (random text generator)

}


override func didReceiveMemoryWarning() {

super.didReceiveMemoryWarning()

// Dispose of any resources that can be recreated. }

func randomText() -> String {
    let words = ["Place", "Cat", "House"]
    return words[Int(arc4random_uniform(UInt32(words.count)))]
}

Position the cursor in the Word document where you want to generate random text. Type =LOREM(number of paragraphs, number of sentences) such as =LOREM(3,2). Press Enter.

Position the cursor in the document where you want to generate random text. Type =RAND(number of paragraphs, number of sentences) such as =RAND(3,2). Press Enter.