5
$\begingroup$

How to take a 3 random given name?

I tried:

enter image description here

$\endgroup$
  • 7
    $\begingroup$ RandomEntity["GivenName", 3]... $\endgroup$ – C. E. Sep 28 '16 at 12:23
4
$\begingroup$

IMO the best way is RandomEntity as C.E. points out in the comments:

RandomEntity["GivenName", 3]

enter image description here

But another (deterministic) way is with the property "SampleEntities":

Take[EntityValue["GivenName", "SampleEntities"], UpTo[3]]

enter image description here

$\endgroup$
2
$\begingroup$

One approach is to use RandomChoice[ ] to get your random names:

list = EntityList["GivenName"];
RandomChoice[list, 3]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ I don't see how this improves on the original situation. Running this now and it looks like it will take an hour to grab the whole list. $\endgroup$ – george2079 Sep 28 '16 at 21:51
  • 1
    $\begingroup$ You only have to download the list once. After that, it should be stored locally. In the program, you can then call RandomChoice many times and sicen it operates on list it is (nearly) instantaneous. $\endgroup$ – bill s Sep 28 '16 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.