Created
June 26, 2015 06:20
-
-
Save tempire/09dca8534fc799135265 to your computer and use it in GitHub Desktop.
Generate arbitrary size of bytes in swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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