ÀÇ»ç-¹«ÀÛÀ§ ¼ö¸¦ ¹ß»ý½Ãŵ´Ï´Ù.
Random, OutputVar [, Min, Max] Random, , NewSeed
°á°ú¸¦ ÀúÀåÇÒ º¯¼öÀÇ À̸§. ÀúÀåµÈ ºÎµ¿ ¼Ò¼öÁ¡ ¼öÀÇ Çü½ÄÀº SetFormat¿¡ ÀÇÇÏ¿© °áÁ¤µË´Ï´Ù.
»ý¼ºµÉ °¡Àå Å« ¼ö, À½¼ö³ª ºÎµ¿ ¼Ò¼öÁ¡ ¼ö ¶Ç´Â Ç¥Çö½Ä °¡´É. »ý·«Çϸé, °¡Àå Å« ¼ö´Â Á¤¼ö¿¡ ´ëÇÏ¿© 2147483647ÀÔ´Ï´Ù (±×·¯³ª ºÎµ¿ ¼Ò¼öÁ¡ ¼ö´Â Á¦ÇÑÀÌ ¾ø½À´Ï´Ù).
ÀÌ ¸ðµå´Â ¹«ÀÛÀ§ ¼ö ¹ß»ýÀÚ¿¡ NewSeed·Î ´Ù½Ã ¾¾¾ÑÀ» ¸ÔÀÔ´Ï´Ù (Ç¥Çö½Ä °¡´É). ÀÌ°ÍÀº ÀÌ¾î ¹ß»ýµÇ´Â ¸ðµç ¹«ÀÛÀ§ ¼ö¿¡ ¿µÇâÀ» ¹ÌĨ´Ï´Ù. NewSeed´Â 0ºÎÅÍ 4294967295 (0xFFFFFFFF) »çÀÌÀÇ Á¤¼ö¿©¾ß ÇÕ´Ï´Ù. ´Ù½Ã ¾¾¾Ñ ¸Ô±â±â´Â ¹ß»ýµÈ ¹«ÀÛÀ§ ¼öÀÇ Ç°Áú/º¸¾È¼ºÀ» Çâ»ó½Ãų ¼ö ÀÖ½À´Ï´Ù. ƯÈ÷ NewSeed°¡ Ç°ÁúÀÌ ¶³¾îÁö´Â ÀÇ»ç-¹«ÀÛÀ§ ¼ö°¡ ¾Æ´Ï¶ó ÁøÂ¥ ¹«ÀÛÀ§¼öÀÌ¸é ´õ ÁÁ½À´Ï´Ù. ÀϹÝÀûÀ¸·Î, ¾¾¾Ñ ´Ù½Ã ¸ÔÀ̱â´Â ÇÑ ¹ø ÀÌ»ó ÇÒ ÇÊ¿ä°¡ ¾ø½À´Ï´Ù.
½ºÅ©¸³Æ®¿¡¼ ´Ù½Ã ¾¾¾Ñ ¸ÔÀ̱Ⱑ »ç¿ëµÇÁö ¾Ê¾Ò´Ù¸é, ¾¾¾ÑÀº 64-ºñÆ® °ªÀÇ ¾Æ·¡ÂÊ 32-ºñÆ®·Î ½ÃÀÛÇÕ´Ï´Ù. ÀÌ °ªÀº 1601³â 1¿ù 1ÀÏ ÀÌÈÄ·Î 100-³ª³ëÃÊ °£°ÝÀ¸·Î ³ª´« °³¼öÀÔ´Ï´Ù. ÀÌ °ªÀº ~7.2 ºÐ¸¶´Ù 0ºÎÅÍ 4294967295 »çÀ̸¦ ¿Ô´Ù °¬´Ù ÇÕ´Ï´Ù.
ÀÌ ¸í·É¾î´Â ÀÇ»ç-¹«ÀÛÀ§ ¼ö¸¦ »êÃâÇÕ´Ï´Ù. ÀÌ ¼ö´Â ÁøÂ¥ ¹«ÀÛÀ§ ¼ö¸¦ Èä³» ³»Áö¸¸ ½ÇÁ¦·Î´Â ´ÙÀ½ ¼ýÀÚ°¡ ¹«¾ùÀÎÁö ÃßÃø/°áÁ¤ÇϱⰡ Áö±ØÈ÷ ¾î·Á¿î º¹ÀâÇÑ °ø½Ä¿¡ ±â¹ÝÇÑ ¼ýÀÚÀÏ »ÓÀÔ´Ï´Ù.
ÁöÁ¤µÈ ¹üÀ§ ¾ÈÀÇ ¼ýÀÚ´Â ¸ðµÎ ´ë·« ºñ½ÁÇÑ ºóµµ·Î ¹ß»ýµË´Ï´Ù (±×·¸Áö¸¸, ¾Æ·¡ÀÇ "¾Ë·ÁÁø ÇÑ°è"¸¦ ÂüÁ¶ÇϽʽÿÀ).
Min ¶Ç´Â Max¿¡ ¼Ò¼ö Á¡ÀÌ µé¾î ÀÖ´Ù¸é, ÃÖÁ¾ °á°ú´Â ºÎµ¿ ¼Ò¼öÁ¡ ¼ö°¡ µË´Ï´Ù. Çü½ÄÀº SetFormat¿¡ ÀÇÇÏ¿© °áÁ¤µË´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é, ±× °á°ú´Â Á¤¼öÀÔ´Ï´Ù.
¾Ë·ÁÁø ÇÑ°è: ºÎµ¿ ¼Ò¼öÁ¡ ¼ö¿¡ ´ëÇÏ¿©
Random, rand, 1, 10 Random, rand, 0.0, 1.0
This function uses the Mersenne Twister random number generator, MT19937, written by Takuji Nishimura and Makoto Matsumoto, Shawn Cokus, Matthe Bellew and Isaku Wada.
The Mersenne Twister is an algorithm for generating random numbers. It was designed with consideration of the flaws in various other generators. The period, 219937-1, and the order of equidistribution, 623 dimensions, are far greater. The generator is also fast; it avoids multiplication and division, and it benefits from caches and pipelines. For more information see the inventors' web page at www.math.keio.ac.jp/~matumoto/emt.html
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Do NOT use for CRYPTOGRAPHY without securely hashing several returned values together, otherwise the generator state can be learned after reading 624 consecutive values.
When you use this, send an email to: matumoto@math.keio.ac.jp with an appropriate reference to your work. It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu when you write.
This above has been already been done for AutoHotkey, but if you use the Random command in a publicly distributed application, consider sending an e-mail to the above people to thank them.