1. This is a test

I'm tryin to find the effects of set_rand on different processors.  So could
everybody try the following code and report the results back to me

include machine.e
include get.e

integer i

set_rand(123)
? rand(1000)
set_rand(236)
? rand(1000)
set_rand(10)
? rand(1000)
set_rand(409)
? rand(1000)
i = wait_key()

You will have four numbers displayed, please report these back to me.

new topic     » topic index » view message » categorize

2. Re: This is a test

110
797
422
463




Adam Weeden <SkaMan325 at AOL.COM> on 23/11/98 09:05:51

Please respond to Euphoria Programming for MS-DOS
      <EUPHORIA at LISTSERV.MUOHIO.EDU>

To:   EUPHORIA at LISTSERV.MUOHIO.EDU
cc:    (bcc: Jason McLennan/FSq/TreasFin)
Subject:  This is a test




I'm tryin to find the effects of set_rand on different processors.  So
could
everybody try the following code and report the results back to me

include machine.e
include get.e

integer i

set_rand(123)
? rand(1000)
set_rand(236)
? rand(1000)
set_rand(10)
? rand(1000)
set_rand(409)
? rand(1000)
i = wait_key()

You will have four numbers displayed, please report these back to me.

new topic     » goto parent     » topic index » view message » categorize

3. Re: This is a test

I always get the following:

110
797
422
463

Adam Weeden wrote:
>
> I'm tryin to find the effects of set_rand on different processors.  So could
> everybody try the following code and report the results back to me
>
> include machine.e
> include get.e
>
> integer i
>
> set_rand(123)
> ? rand(1000)
> set_rand(236)
> ? rand(1000)
> set_rand(10)
> ? rand(1000)
> set_rand(409)
> ? rand(1000)
> i = wait_key()
>
> You will have four numbers displayed, please report these back to me.

new topic     » goto parent     » topic index » view message » categorize

4. Re: This is a test

110
797
422
463

Albert
P.S: I think I see a pattern. smile

new topic     » goto parent     » topic index » view message » categorize

5. Re: This is a test

>I'm tryin to find the effects of set_rand on different processors.  So
could
>everybody try the following code and report the results back to me


Effects on different processors ?
Hmm, their will be *no* difference in result.
If you read up the documentation, you will find that rand () uses the
current time, and perform some weird statistical calculation on it. However,
to test/debug/reproduce a bug you can use set_rand () to always get the same
results. That's the purpose. And there is no need to use set_rand () what so
ever, other than for debugging. And there is no need to try your code,
because I will get the same results as you do. Randomizing is *not* a
chip-specific command, it's a routine in one of the watcom libraries, and it
will only differ in speed, and sometimes, it could in theory have a
different result for those chips who have the bug of the first pentiums.

Now, what is it, you are trying to do ?

Ralf

new topic     » goto parent     » topic index » view message » categorize

6. Re: This is a test

>I'm tryin to find the effects of set_rand on different processors.  So
could
>everybody try the following code and report the results back to me


110
797
422
463

Machine: Celeron 300. WinTec Motherboard

Regards,
    Daniel   Berstein
    daber at pair.com

new topic     » goto parent     » topic index » view message » categorize

7. Re: This is a test

Thanx to everyone for all their help, in case anybody was wondering this test
was to determine if i could write an encrypting program AND release the source
code.  The test was a success.  I should have it to the group soon.

new topic     » goto parent     » topic index » view message » categorize

8. Re: This is a test

Ralf wrote:
>And there is no need to use set_rand () what so ever, other than for
>debugging.

Well, there ARE reasons to use set_rand()... For example, my encryption
program (unreleased, at least until I find some hacker who can crack a
file encrypted by it.. I don't know the U.S. export encryption laws and
don't wanna break 'em!) uses it as the base for encryption! It seeds the
randomizer a number based on the password, then adds rand(255) to each
byte in the file.

There are also other good reasons... Such as using set_rand() before
shuffling the deck of cards in a solitare game (I've seen that used a
bunch, you can enter the game number [which is passed to whatever seeds
the randomizer in whatever language they used] and have the cards delt
the same way as they were last time you entered that number.

(Sorry, just had to disprove that theory... everything else in there
seems about right... Well, based on other posts, the randomizer may be
nonstandard, not part of Watcom's routines, but that's it, I promise! :)

BTW, others seem to have done the same thing I've done here with
encryption programs... A little trick in getting your files harder to
break is to encrypt multiple times with different passwords. smile (And a
decryption with a 'wrong' password, which will have to be encrypted with
that password to restore...)

new topic     » goto parent     » topic index » view message » categorize

9. Re: This is a test

>Well, there ARE reasons to use set_rand()... For example, my encryption
>program (unreleased, at least until I find some hacker who can crack a
>file encrypted by it.. I don't know the U.S. export encryption laws and
>don't wanna break 'em!) uses it as the base for encryption! It seeds the
>randomizer a number based on the password, then adds rand(255) to each
>byte in the file.

I wonder, I could write the encryption program now without any problem, are
you not already breaking the U.S. (hilarious) export encryption laws ?

Where would they draw the line from explenation to pseudo-code to
working-code ?
I know they sent the code of PGP to europe by printing all the code out, and
simply mail it. (that *was* legal, for some reason) .. so all companies over
here could also *legally* use the product. Oh well, guess I just have to let
those politicans defend their personal virtual fortress of self-manipulation
and fake safety.

>There are also other good reasons... Such as using set_rand() before
>shuffling the deck of cards in a solitare game (I've seen that used a
>bunch, you can enter the game number [which is passed to whatever seeds
>the randomizer in whatever language they used] and have the cards delt
>the same way as they were last time you entered that number.


Yeah, yeah... ok ok.. so there are situations where we use set_rand () other
than for debugging. You've proven that, but I dont think that was your
original goal, was it ? For all current versions of Euphoria, set_rand ()
will return the same value. Only watch out with alternative interpreters
like Peu & (dropped) GNU-Euphoria, that use different libraries. (it doesnt
yet provide a set_rand function anyway)

Ralf

new topic     » goto parent     » topic index » view message » categorize

10. Re: This is a test

On Mon, 23 Nov 1998 19:30:05 +0100, Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL>
wrote:

>
>Yeah, yeah... ok ok.. so there are situations where we use set_rand () other
>than for debugging. You've proven that, but I dont think that was your
>original goal, was it ? For all current versions of Euphoria, set_rand ()
>will return the same value. Only watch out with alternative interpreters
>like Peu & (dropped) GNU-Euphoria, that use different libraries. (it doesnt
>yet provide a set_rand function anyway)
>
>Ralf

    I do have a work around for this situtiation also.
You build your own random data/generator.  You can then
use that stable random data on any platform for encryption
purposes.  It would be roughly as secure a key as set_rand()
and would be gauranteed to work on any and all platforms.
You could even build this table using the current rand()
generated data.  The idea is that once you build the table
of random data you never alter it.  There many ways to
produce different random seeds from just one table.  The
most obvious is offsetting.  Offsetting is also the least
random like.  I can easily go into great detail on this
subject since I have given it deep thought.  I have also
come up with several other methods of encryption but have
found little practicle use for it.  I see little use for
encryption even though I find it rather interesting.

_________________________

Lucius L. Hilley III    lhilley at cdc.net
http://www.cdc.net/~lhilley
http://www.americanantiques.com
http://www.dragonvet.com
_________________________

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu