Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra Credit 3: Add RAND operation button #14

Closed
petervanhoef opened this issue Mar 25, 2017 · 0 comments
Closed

Extra Credit 3: Add RAND operation button #14

petervanhoef opened this issue Mar 25, 2017 · 0 comments

Comments

@petervanhoef
Copy link
Owner

Makeoneofyouroperationbuttonsbe“generatearandomdouble-precisionfloating point number between 0 and 1”. This operation button is not a constant (since it changes each time you invoke it). Nor is it a unary operation (since it does not operate on anything). Probably the easiest way to generate a random number in iOS is the global Swift function arc4random() which generates a random number between 0 and the largest possible 32-bit integer (UInt32.max). You’ll have to get to double precision floating point number from there, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant