Article View: adobe.scripting.indesign
Article #1898[JS CS3] Check the pattern of a random number given a specific data ?
From: loic_aigon
Date: Wed, 14 Jan 2009 20:37
Date: Wed, 14 Jan 2009 20:37
17 lines
1123 bytes
1123 bytes
Hi all, I succeed getting a random number of this look : d.dd (8.73 for ex) I use Math.random()*(max-min)+min; I want to check that this number respect a specific given increment. To be clear : If I set min to 0 and max to 10 for example. The script returns a number like 8.56 Now, I have a increment like 0.2 I want the script to give me a number that can be d,d.2,d.4,d.6,d.8 BUT NOT d.78 or d.1 I guess I may use a while command but have no idea of the checking operation. Any idea ? Thanks in advance. Loic
Technical Details
Message-ID:
<59b783cc.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,c561291f93dd622f,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: loic_aigon <loic_aigon@yahoo.fr> Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: [JS CS3] Check the pattern of a random number given a specific data ? Message-ID: <59b783cc.-1@webcrossing.la2eafNXanI> Date: Wed, 14 Jan 2009 12:37:18 -0800 Lines: 18 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit