Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Print a random integer - Works in Screen Savers



I've read through the list so far and noticed earlier a problem people had generating random numbers in screen savers. I have written a small macro that seems to work in both QC and as a screen saver, so I thought I'd share.

The file is a working example that should print three random numbers between 0 and 1,000,000,000

The macro is inside three times, and yes, you can copy and paste it to generate separate random values. It uses the Javascript function Math.random, I don't know why it works where others seem to have failed... (maybe because of the javascript conditional used).

The Macro has two inputs that specify the range of the random integer generated (0 - 1,000,000,000 for each). The output is a single (non- changing) random integer within that range.

Hope this helps a few people, and if anyone knows a cleaner way to do this, I'd like to know it.

Attachment: RandomInteger.qtz
Description: application/quartzcomposer


Sam

------------------------------------------
Sam Bauers

Viveka Web

email@hidden
http://www.viveka.net.au

PO Box 1232
Strawberry Hills, NSW 2012

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.