🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
6 messages
6 total messages Started by Ed_DeWan Fri, 05 Jan 2007 20:30
random number generator
#449
Author: Ed_DeWan
Date: Fri, 05 Jan 2007 20:30
1 lines
607 bytes
Is there a way to generate true random numbers in PostScript level III?
Re: random number generator
#450
Author: Alex_Cherepanov
Date: Fri, 05 Jan 2007 23:47
8 lines
974 bytes
Ed_DeWan@adobeforums.com wrote:
> Is there a way to generate true random numbers in PostScript level III?
Of course - even in the level 2.
Host-based PostScript interpreters can read files,
for instance /dev/random

Regards,
Alex Cherepanov
Re: random number generator
#451
Author: Ed_DeWan
Date: Mon, 08 Jan 2007 20:03
1 lines
1146 bytes
Thank you for your reply to my post about random number generators. It had occurred to me that external files might be the only way to solve my problem, but file reading was something that I had never attempted. After a couple of days struggle with it, I have finally got the hang of it, and it will do the job, albeit in a clumsy way. What I don't understand is what purpose the rand function is intended to serve. I can't think of any!
Re: random number generator
#452
Author: Helge_Blischke
Date: Tue, 09 Jan 2007 14:36
3 lines
866 bytes
The rand operator is similar to the rand function known in UNIX ("simple random number generator") and should be initialized by executing the srand operator to define the initial seed.

Helge
Re: random number generator
#453
Author: Ed_DeWan
Date: Tue, 09 Jan 2007 16:39
1 lines
822 bytes
So, you have to supply your own seed, presumably "at random"? I have solved this problem by using Perl to generate a file of random numbers suitable for my PostScript application, and then reading them in with the read command, as per Alex's suggestion.
Re: random number generator
#454
Author: Aidan Karley
Date: Wed, 10 Jan 2007 02:53
24 lines
2435 bytes
In article <3bc2c286.3@webcrossing.la2eafNXanI>,  wrote:
> So, you have to supply your own seed, presumably "at random"? 
> I have solved this problem by using Perl to generate a file 
> of random numbers
>
       I haven't noticed what sort of system you're working on. 
Most unix-alikes (Unices, BSDs, OS-X for Macs, Linuxens, and 
names too numerous to mention) have a system device that 
accumulates randomness from timing of system events (keystrokes, 
mouse movements, network packets), stores randomness in a system 
parameter across re-boots, and generally provides quite good 
quality randomness for the asking without the user needing to go 
into making their own randomness. 
dd -if /dev/random -of /path/to/destination [various parameters]
       
       Windows also provides such services, but they don't seem 
to be as user-visible as on the unices. See for example 
msdn2.microsoft.com/en-us/library/system.random(VS.80).aspx 
(it's a damned slow page to load).

-- 
 Aidan Karley, FGS
 Aberdeen, Scotland
 Written at Wed, 10 Jan 2007 01:55 GMT, but posted later.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads