For Programmers: Free Programming Magazines  


Home > Archive > PostScript > February 2006 > srand









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author srand
ivan.svaljek@gmail.com

2006-02-20, 7:56 am

What can be passed as a seed to this function ?

Is there a way to output the result of a function as text, to print the
value of rand for example ?

hoffmann@fho-emden.de

2006-02-20, 7:56 am

A PostScript pseudo random generator should generate
integer numbers in the range 1 to (2^31-1) .
IMO the value 0 is excluded (should be checked, can
depend on the implementation).
The seed is one of these numbers.
Because there is no fixed law for the implementation,
the results will differ e.g. for PDF and printers.
Therefore it's often recommended to program ones own
generator. A simple example is here:
http://www.fho-emden.de/~hoffmann/ranpoint14032004.pdf

The number can be printed
1. Define a font (page 7)
2. Define a string buffer buf (page 7)
3. x y moveto number buf cvs show

Best regards --Gernot Hoffmann

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com