dimanche 18 août 2019

C program - How do I use the -r option within Xcode?

In this project for my C program I am requested to invoke it with -r (see below), but I am not sure how to do this in Xcode. Where is this done?

“ ...because the program uses a fixed seed — invoke it with -r if you want different output each time"

I presume the requirement is to use the -r as a command line argument. Am I right? This is my assumption.

This is what I have done.... Product > Scheme > Edit Scheme

Step 1 - Info tab Select Arguments Passed on Launch For Executable, navigate to the Terminal app Uncheck Debug executable

Step 2 - Arguments tab Add the following into the Arguments Passed On Launch field: ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME} --> ${BUILT_PRODUCTS_DIR}/${CoinToss1}

-r

But doing the above has not made any difference.

The -r option has not had any effect doing it this way, because it is still using the same seed and producing identical output for the coin tosses.

Project guidelines here: http://www.pcg-random.org/using-pcg-c-basic.html

Thanks




Aucun commentaire:

Enregistrer un commentaire