Update write-joke.ps1

This commit is contained in:
Markus Fleschutz 2021-10-18 07:24:55 +02:00 committed by GitHub
parent d5a0a2a7e5
commit 7f298f5722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,9 @@
try {
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,$NumRows - 1)
$Index = [int]$Generator.next(0, $Table.Count - 1)
$Joke = $Table[$Index].Joke
"$Joke 😂"