2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 % RRRR AAA N N DDDD OOO M M %
6 % R R A A NN N D D O O MM MM %
7 % RRRR AAAAA N N N D D O O M M M %
8 % R R A A N NN D D O O M M %
9 % R R A A N N DDDD OOO M M %
12 % MagickCore Methods to Generate Random Numbers %
19 % Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
20 % dedicated to making software imaging solutions freely available. %
22 % You may not use this file except in compliance with the License. You may %
23 % obtain a copy of the License at %
25 % http://www.imagemagick.org/script/license.php %
27 % Unless required by applicable law or agreed to in writing, software %
28 % distributed under the License is distributed on an "AS IS" BASIS, %
29 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
30 % See the License for the specific language governing permissions and %
31 % limitations under the License. %
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 % The generation of random numbers is too important to be left to chance.
36 % -- Tom Christiansen <tchrist@mox.perl.com>
47 #if defined(__MINGW32__)
50 #include "MagickCore/studio.h"
51 #include "MagickCore/exception.h"
52 #include "MagickCore/exception-private.h"
53 #include "MagickCore/memory_.h"
54 #include "MagickCore/semaphore.h"
55 #include "MagickCore/random_.h"
56 #include "MagickCore/random-private.h"
57 #include "MagickCore/resource_.h"
58 #include "MagickCore/signature-private.h"
59 #include "MagickCore/string_.h"
60 #include "MagickCore/thread_.h"
61 #include "MagickCore/thread-private.h"
62 #include "MagickCore/utility.h"
63 #include "MagickCore/utility-private.h"
67 #define PseudoRandomHash SHA256Hash
68 #define RandomEntropyLevel 9
69 #define RandomFilename "reservoir.xdm"
70 #define RandomFiletype "random"
71 #define RandomProtocolMajorVersion 1
72 #define RandomProtocolMinorVersion 0
113 External declarations.
115 #if defined(__APPLE__) && !defined(TARGET_OS_IPHONE)
116 #include <crt_externs.h>
117 #define environ (*_NSGetEnviron())
127 *random_semaphore = (SemaphoreInfo *) NULL;
132 static MagickBooleanType
133 gather_true_random = MagickFalse;
136 Forward declarations.
139 *GenerateEntropicChaos(RandomInfo *);
142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146 % A c q u i r e R a n d o m I n f o %
150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 % AcquireRandomInfo() allocates the RandomInfo structure.
154 % The format of the AcquireRandomInfo method is:
156 % RandomInfo *AcquireRandomInfo(void)
160 static inline size_t MagickMin(const size_t x,const size_t y)
167 MagickExport RandomInfo *AcquireRandomInfo(void)
180 random_info=(RandomInfo *) AcquireMagickMemory(sizeof(*random_info));
181 if (random_info == (RandomInfo *) NULL)
182 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
183 (void) ResetMagickMemory(random_info,0,sizeof(*random_info));
184 random_info->signature_info=AcquireSignatureInfo();
185 random_info->nonce=AcquireStringInfo(2*GetSignatureDigestsize(
186 random_info->signature_info));
187 ResetStringInfo(random_info->nonce);
188 random_info->reservoir=AcquireStringInfo(GetSignatureDigestsize(
189 random_info->signature_info));
190 ResetStringInfo(random_info->reservoir);
191 random_info->normalize=1.0/(~0UL);
192 random_info->secret_key=secret_key;
193 random_info->protocol_major=RandomProtocolMajorVersion;
194 random_info->protocol_minor=RandomProtocolMinorVersion;
195 random_info->semaphore=AllocateSemaphoreInfo();
196 random_info->timestamp=(ssize_t) time(0);
197 random_info->signature=MagickSignature;
201 nonce=GenerateEntropicChaos(random_info);
202 if (nonce == (StringInfo *) NULL)
203 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
204 InitializeSignature(random_info->signature_info);
205 UpdateSignature(random_info->signature_info,nonce);
206 FinalizeSignature(random_info->signature_info);
207 SetStringInfoLength(nonce,(GetSignatureDigestsize(
208 random_info->signature_info)+1)/2);
209 SetStringInfo(nonce,GetSignatureDigest(random_info->signature_info));
210 SetStringInfo(random_info->nonce,nonce);
211 nonce=DestroyStringInfo(nonce);
213 Seed random reservoir with entropic data.
215 entropy=GenerateEntropicChaos(random_info);
216 if (entropy == (StringInfo *) NULL)
217 ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
218 UpdateSignature(random_info->signature_info,entropy);
219 FinalizeSignature(random_info->signature_info);
220 SetStringInfo(random_info->reservoir,GetSignatureDigest(
221 random_info->signature_info));
222 entropy=DestroyStringInfo(entropy);
224 Seed pseudo random number generator.
226 if (random_info->secret_key == ~0UL)
228 key=GetRandomKey(random_info,sizeof(random_info->secret_key));
229 (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(key),
230 GetStringInfoLength(key));
231 key=DestroyStringInfo(key);
238 signature_info=AcquireSignatureInfo();
239 key=AcquireStringInfo(sizeof(random_info->secret_key));
240 SetStringInfoDatum(key,(unsigned char *) &random_info->secret_key);
241 UpdateSignature(signature_info,key);
242 key=DestroyStringInfo(key);
243 FinalizeSignature(signature_info);
244 digest=GetSignatureDigest(signature_info);
245 (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(digest),
246 MagickMin(GetSignatureDigestsize(signature_info),
247 sizeof(*random_info->seed)));
248 signature_info=DestroySignatureInfo(signature_info);
250 random_info->seed[1]=0x50a7f451UL;
251 random_info->seed[2]=0x5365417eUL;
252 random_info->seed[3]=0xc3a4171aUL;
257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
261 + D e s t r o y R a n d o m I n f o %
265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267 % DestroyRandomInfo() deallocates memory associated with the random
270 % The format of the DestroyRandomInfo method is:
272 % RandomInfo *DestroyRandomInfo(RandomInfo *random_info)
274 % A description of each parameter follows:
276 % o random_info: the random info.
279 MagickExport RandomInfo *DestroyRandomInfo(RandomInfo *random_info)
281 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
282 assert(random_info != (RandomInfo *) NULL);
283 assert(random_info->signature == MagickSignature);
284 LockSemaphoreInfo(random_info->semaphore);
285 if (random_info->reservoir != (StringInfo *) NULL)
286 random_info->reservoir=DestroyStringInfo(random_info->reservoir);
287 if (random_info->nonce != (StringInfo *) NULL)
288 random_info->nonce=DestroyStringInfo(random_info->nonce);
289 if (random_info->signature_info != (SignatureInfo *) NULL)
290 random_info->signature_info=DestroySignatureInfo(
291 random_info->signature_info);
292 (void) ResetMagickMemory(random_info->seed,0,sizeof(*random_info->seed));
293 random_info->signature=(~MagickSignature);
294 UnlockSemaphoreInfo(random_info->semaphore);
295 DestroySemaphoreInfo(&random_info->semaphore);
296 random_info=(RandomInfo *) RelinquishMagickMemory(random_info);
301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
305 + G e n e r a t e E n t r o p i c C h a o s %
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311 % GenerateEntropicChaos() generate entropic chaos used to initialize the
314 % The format of the GenerateEntropicChaos method is:
316 % StringInfo *GenerateEntropicChaos(RandomInfo *random_info)
318 % A description of each parameter follows:
320 % o random_info: the random info.
324 #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
325 static ssize_t ReadRandom(int file,unsigned char *source,size_t length)
327 register unsigned char
335 for (q=source; length != 0; length-=count)
337 count=(ssize_t) read(file,q,length);
352 static StringInfo *GenerateEntropicChaos(RandomInfo *random_info)
354 #define MaxEntropyExtent 64
371 Initialize random reservoir.
373 entropy=AcquireStringInfo(0);
374 LockSemaphoreInfo(random_info->semaphore);
375 chaos=AcquireStringInfo(sizeof(unsigned char *));
376 SetStringInfoDatum(chaos,(unsigned char *) &entropy);
377 ConcatenateStringInfo(entropy,chaos);
378 SetStringInfoDatum(chaos,(unsigned char *) entropy);
379 ConcatenateStringInfo(entropy,chaos);
380 pid=(ssize_t) getpid();
381 SetStringInfoLength(chaos,sizeof(pid));
382 SetStringInfoDatum(chaos,(unsigned char *) &pid);
383 ConcatenateStringInfo(entropy,chaos);
384 tid=GetMagickThreadId();
385 SetStringInfoLength(chaos,sizeof(tid));
386 SetStringInfoDatum(chaos,(unsigned char *) &tid);
387 ConcatenateStringInfo(entropy,chaos);
388 #if defined(MAGICKCORE_HAVE_GETRUSAGE) && defined(RUSAGE_SELF)
393 if (getrusage(RUSAGE_SELF,&usage) == 0)
395 SetStringInfoLength(chaos,sizeof(usage));
396 SetStringInfoDatum(chaos,(unsigned char *) &usage);
400 seconds=time((time_t *) 0);
402 #if defined(MAGICKCORE_HAVE_GETTIMEOFDAY)
407 if (gettimeofday(&timer,(struct timezone *) NULL) == 0)
409 seconds=timer.tv_sec;
410 nanoseconds=1000UL*timer.tv_usec;
414 #if defined(MAGICKCORE_HAVE_CLOCK_GETTIME) && defined(CLOCK_REALTIME_HR)
419 if (clock_gettime(CLOCK_REALTIME_HR,&timer) == 0)
421 seconds=timer.tv_sec;
422 nanoseconds=timer.tv_nsec;
426 SetStringInfoLength(chaos,sizeof(seconds));
427 SetStringInfoDatum(chaos,(unsigned char *) &seconds);
428 ConcatenateStringInfo(entropy,chaos);
429 SetStringInfoLength(chaos,sizeof(nanoseconds));
430 SetStringInfoDatum(chaos,(unsigned char *) &nanoseconds);
431 ConcatenateStringInfo(entropy,chaos);
433 #if defined(MAGICKCORE_HAVE_CLOCK)
436 #if defined(MAGICKCORE_HAVE_TIMES)
441 (void) times(&timer);
442 nanoseconds=timer.tms_utime+timer.tms_stime;
445 SetStringInfoLength(chaos,sizeof(nanoseconds));
446 SetStringInfoDatum(chaos,(unsigned char *) &nanoseconds);
447 ConcatenateStringInfo(entropy,chaos);
448 #if defined(MAGICKCORE_HAVE_MKSTEMP)
456 filename=ConstantString("magickXXXXXX");
457 file=mkstemp(filename);
459 setmode(file,O_BINARY);
463 (void) remove_utf8(filename);
464 SetStringInfoLength(chaos,strlen(filename));
465 SetStringInfoDatum(chaos,(unsigned char *) filename);
466 ConcatenateStringInfo(entropy,chaos);
467 filename=DestroyString(filename);
470 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
482 Not crytographically strong but better than nothing.
484 seconds=NTElapsedTime()+NTUserTime();
485 SetStringInfoLength(chaos,sizeof(seconds));
486 SetStringInfoDatum(chaos,(unsigned char *) &seconds);
487 ConcatenateStringInfo(entropy,chaos);
488 if (QueryPerformanceCounter(&nanoseconds) != 0)
490 SetStringInfoLength(chaos,sizeof(nanoseconds));
491 SetStringInfoDatum(chaos,(unsigned char *) &nanoseconds);
492 ConcatenateStringInfo(entropy,chaos);
495 Our best hope for true entropy.
497 SetStringInfoLength(chaos,MaxEntropyExtent);
498 status=NTGatherRandomData(MaxEntropyExtent,GetStringInfoDatum(chaos));
500 ConcatenateStringInfo(entropy,chaos);
517 Not crytographically strong but better than nothing.
519 if (environ != (char **) NULL)
525 Squeeze some entropy from the sometimes unpredicatble environment.
527 for (i=0; environ[i] != (char *) NULL; i++)
529 SetStringInfoLength(chaos,strlen(environ[i]));
530 SetStringInfoDatum(chaos,(unsigned char *) environ[i]);
531 ConcatenateStringInfo(entropy,chaos);
534 filename=AcquireString("/dev/urandom");
535 device=StringToStringInfo(filename);
536 device=DestroyStringInfo(device);
537 file=open_utf8(filename,O_RDONLY | O_BINARY,0);
538 filename=DestroyString(filename);
541 SetStringInfoLength(chaos,MaxEntropyExtent);
542 count=ReadRandom(file,GetStringInfoDatum(chaos),MaxEntropyExtent);
544 SetStringInfoLength(chaos,(size_t) count);
545 ConcatenateStringInfo(entropy,chaos);
547 if (gather_true_random != MagickFalse)
550 Our best hope for true entropy.
552 filename=AcquireString("/dev/random");
553 device=StringToStringInfo(filename);
554 device=DestroyStringInfo(device);
555 file=open_utf8(filename,O_RDONLY | O_BINARY,0);
556 filename=DestroyString(filename);
559 filename=AcquireString("/dev/srandom");
560 device=StringToStringInfo(filename);
561 device=DestroyStringInfo(device);
562 file=open_utf8(filename,O_RDONLY | O_BINARY,0);
566 SetStringInfoLength(chaos,MaxEntropyExtent);
567 count=ReadRandom(file,GetStringInfoDatum(chaos),MaxEntropyExtent);
569 SetStringInfoLength(chaos,(size_t) count);
570 ConcatenateStringInfo(entropy,chaos);
575 chaos=DestroyStringInfo(chaos);
576 UnlockSemaphoreInfo(random_info->semaphore);
581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585 % G e t P s e u d o R a n d o m V a l u e %
589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
591 % GetPseudoRandomValue() return a non-negative double-precision floating-point
592 % value uniformly distributed over the interval [0.0, 1.0) with a 2 to the
595 % The format of the GetPseudoRandomValue method is:
597 % double GetPseudoRandomValue(RandomInfo *randon_info)
599 % A description of each parameter follows:
601 % o random_info: the random info.
604 MagickExport double GetPseudoRandomValue(RandomInfo *random_info)
606 register unsigned long
612 seed=random_info->seed;
615 alpha=(unsigned long) (seed[1] ^ (seed[1] << 11));
619 seed[0]=(seed[0] ^ (seed[0] >> 19)) ^ (alpha ^ (alpha >> 8));
620 } while (seed[0] == ~0UL);
621 return(random_info->normalize*seed[0]);
625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 % G e t R a n d o m K e y %
633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
635 % GetRandomKey() gets a random key from the reservoir.
637 % The format of the GetRandomKey method is:
639 % StringInfo *GetRandomKey(RandomInfo *random_info,const size_t length)
641 % A description of each parameter follows:
643 % o random_info: the random info.
645 % o length: the key length.
648 MagickExport StringInfo *GetRandomKey(RandomInfo *random_info,
654 assert(random_info != (RandomInfo *) NULL);
655 key=AcquireStringInfo(length);
656 SetRandomKey(random_info,length,GetStringInfoDatum(key));
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665 % G e t R a n d o m S e c r e t K e y %
669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
671 % GetRandomSecretKey() returns the random secet key.
673 % The format of the GetRandomSecretKey method is:
675 % unsigned long GetRandomSecretKey(const RandomInfo *random_info)
677 % A description of each parameter follows:
679 % o random_info: the random info.
681 MagickExport unsigned long GetRandomSecretKey(const RandomInfo *random_info)
683 return(random_info->secret_key);
687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
691 % G e t R a n d o m V a l u e %
695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697 % GetRandomValue() return a non-negative double-precision floating-point
698 % value uniformly distributed over the interval [0.0, 1.0) with a 2 to the
699 % 128th-1 period (not cryptographically strong).
701 % The format of the GetRandomValue method is:
703 % double GetRandomValue(void)
706 MagickExport double GetRandomValue(RandomInfo *random_info)
715 SetRandomKey(random_info,sizeof(key),(unsigned char *) &key);
716 } while (key == range);
717 return((double) key/range);
721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
725 + R a n d o m C o m p o n e n t G e n e s i s %
729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
731 % RandomComponentGenesis() instantiates the random component.
733 % The format of the RandomComponentGenesis method is:
735 % MagickBooleanType RandomComponentGenesis(void)
738 MagickPrivate MagickBooleanType RandomComponentGenesis(void)
740 AcquireSemaphoreInfo(&random_semaphore);
745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749 + R a n d o m C o m p o n e n t T e r m i n u s %
753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
755 % RandomComponentTerminus() destroys the random component.
757 % The format of the RandomComponentTerminus method is:
759 % RandomComponentTerminus(void)
762 MagickPrivate void RandomComponentTerminus(void)
764 if (random_semaphore == (SemaphoreInfo *) NULL)
765 AcquireSemaphoreInfo(&random_semaphore);
766 DestroySemaphoreInfo(&random_semaphore);
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
774 % S e t R a n d o m K e y %
778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
780 % SetRandomKey() sets a random key from the reservoir.
782 % The format of the SetRandomKey method is:
784 % void SetRandomKey(RandomInfo *random_info,const size_t length,
785 % unsigned char *key)
787 % A description of each parameter follows:
789 % o random_info: the random info.
791 % o length: the key length.
797 static inline void IncrementRandomNonce(StringInfo *nonce)
805 datum=GetStringInfoDatum(nonce);
806 for (i=(ssize_t) (GetStringInfoLength(nonce)-1); i != 0; i--)
812 ThrowFatalException(RandomFatalError,"SequenceWrapError");
815 MagickExport void SetRandomKey(RandomInfo *random_info,const size_t length,
821 register unsigned char
830 assert(random_info != (RandomInfo *) NULL);
833 LockSemaphoreInfo(random_info->semaphore);
834 signature_info=random_info->signature_info;
835 datum=GetStringInfoDatum(random_info->reservoir);
837 for (p=key; (i != 0) && (random_info->i != 0); i--)
839 *p++=datum[random_info->i];
841 if (random_info->i == GetSignatureDigestsize(signature_info))
844 while (i >= GetSignatureDigestsize(signature_info))
846 InitializeSignature(signature_info);
847 UpdateSignature(signature_info,random_info->nonce);
848 FinalizeSignature(signature_info);
849 IncrementRandomNonce(random_info->nonce);
850 (void) CopyMagickMemory(p,GetStringInfoDatum(GetSignatureDigest(
851 signature_info)),GetSignatureDigestsize(signature_info));
852 p+=GetSignatureDigestsize(signature_info);
853 i-=GetSignatureDigestsize(signature_info);
857 InitializeSignature(signature_info);
858 UpdateSignature(signature_info,random_info->nonce);
859 FinalizeSignature(signature_info);
860 IncrementRandomNonce(random_info->nonce);
861 SetStringInfo(random_info->reservoir,GetSignatureDigest(signature_info));
863 datum=GetStringInfoDatum(random_info->reservoir);
867 UnlockSemaphoreInfo(random_info->semaphore);
871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
875 % S e t R a n d o m S e c r e t K e y %
879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
881 % SetRandomSecretKey() sets the pseudo-random number generator secret key.
883 % The format of the SetRandomSecretKey method is:
885 % void SetRandomSecretKey(const unsigned long key)
887 % A description of each parameter follows:
892 MagickExport void SetRandomSecretKey(const unsigned long key)
898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
902 % S e t R a n d o m T r u e R a n d o m %
906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
908 % SetRandomTrueRandom() declares your intentions to use true random numbers.
909 % True random numbers are encouraged but may not always be practical because
910 % your application may block while entropy is gathered from your environment.
912 % The format of the SetRandomTrueRandom method is:
914 % void SetRandomTrueRandom(const MagickBooleanType true_random)
916 % A description of each parameter follows:
918 % o true_random: declare your intentions to use true-random number.
921 MagickExport void SetRandomTrueRandom(const MagickBooleanType true_random)
923 gather_true_random=true_random;