Mailing Lists: Apple Mailing Lists

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

Re: Alternative to Math.random()?



I would guess you'd have to seed random with a call to Math.srandom (). If you want your widget to behave in a deterministic fashion, use the same seed every time. If not, you could seed it with part of the time. Maybe this'll work:

var date = new Date();
Math.srandom(date.getMilliseconds());

-Tom

On Jun 19, 2005, at 7:22 PM, Don McConnell wrote:

Hello ...


Math.random() doesn't seem to get seeded when a widget is launched.

What's a good alternative random number generator?


Thanks and regards ...


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


This email sent to email@hidden


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

This email sent to email@hidden
References: 
 >Alternative to Math.random()? (From: Don McConnell <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.