Random Word Function

In order to test some websites I had need to have a function that produced random words.

I found this random word Json list. https://raw.githubusercontent.com/RazorSh4rk/random-word-api/master/words.json

And decided to wrap a small function around it:

function Get-RandomWord
if(-not $words)

$Script:words = (invoke-webrequest -Uri https://raw.githubusercontent.com/RazorSh4rk/random-word-api/master/words.json).content | convertfrom-json


$words["$(get-random -Maximum ($words.count))"]


if you wish to change to your own list of random words just change the json location to a local directory with a json file or a different web url that contains the json you want to Randomize.


Until then

I hope this helps someone




3 thoughts on “Random Word Function

  1. Malcolm Chalmers

    I tried to get the API suggested by CRSHNBRN66 working as well, but couldn’t.
    Your script however works great every time.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s