Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param(
- [Parameter(Mandatory=$true)]
- [string]$name,
- [Parameter(Mandatory=$true)]
- [long]$size
- )
- $random = new-object Random
- $linePerMB = 1024
- $dataPerLine = 256
- $lines = @("") * $linePerMB
- $data = @(0) * $dataPerLine
- for($mb = 1; $mb -le $size / 1MB; $mb++) {
- for($line = 0; $line -lt $linePerMB; $line++) {
- for($i = 0; $i -lt $dataPerLine; $i++) {
- $data[$i] = $random.Next(100, 1000)
- }
- $lines[$line] = [string]::Join(',', $data)
- }
- [string]::Join("`n", $lines) | out-file $name -encoding utf8 -append
- write-host "${mb}MB done"
- }
Advertisement
Add Comment
Please, Sign In to add comment