Skip to content

Instantly share code, notes, and snippets.

@tempire
Created June 26, 2015 06:20
Show Gist options
  • Select an option

  • Save tempire/09dca8534fc799135265 to your computer and use it in GitHub Desktop.

Select an option

Save tempire/09dca8534fc799135265 to your computer and use it in GitHub Desktop.
Generate arbitrary size of bytes in swift
let max = 1024*1024*200
var data = NSMutableData(capacity: max)
for var i=0; i<max/4; ++i {
var random = arc4random()
data?.appendBytes(&random, length: 4)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment