Page 1 of 1

windows linux compatability

Posted: Tue Feb 21, 2006 8:49 pm
by Patz QuickBASIC Creations
can someone run this code through freebasic on windows and give me the output?

Code: Select all

randomize462
print rnd
thanks :lol: ,
(i am looking for an output of 0.3176822056993842)

Posted: Tue Feb 21, 2006 9:23 pm
by MystikShadows
I got 0.778656005859375

but that's all I constantly get no matter how many times I execute it...which is, in fact..normal behavior ;-).

FreeBasic

Posted: Wed Feb 22, 2006 12:39 pm
by Zim
Code:

randomize 462 (I put a space in it)
print rnd

Here's the output:

0.778656005859375

Re: windows linux compatability

Posted: Wed Feb 22, 2006 4:15 pm
by bungytheworm
Patz QuickBASIC Creations wrote: (i am looking for an output of 0.3176822056993842)
0.317682205699384

Ok, im on linux too
:lol:

Posted: Wed Feb 22, 2006 4:41 pm
by Patz QuickBASIC Creations
Sorry, I got my brother to type that message. He's QB illiterate :)

Anyway, I knew that you should get the same output each time you run it, but I wasn't sure if Windows and Linux had similar Random Number Generaters. I guess my program won't work, now.


The program (DCPPP - Date Changing Password Protection Program) changes it's password everyday. It parses the date, using RANDOMIZE on it, then makes a loop making an 8 character string using random, typable characters. I needed to know if FB for Windows and Linux had the same Random output so I could lock Linux and output a password list on Windows. Oh, well. Back to the drawing board... :lol:[/list]

Posted: Wed Feb 22, 2006 10:41 pm
by RyanKelly
Some Linux kernels provide a random number generator that "collects entropy" whenever a system call is made or certain hardware handling takes place. It's specifically designed to prevent one machine from generating the same sequence as another for the purpose of defeating authentication schemes. I don't know if the FB for Linux code uses this or some other random number generator, but it probably does.

Posted: Fri Feb 24, 2006 10:36 pm
by DrV
Yeah, FB's RANDOMIZE and RND are built around the libc srand() and rand() functions, which are implemented differently on various platforms. You could probably get away with writing your own pseudo-random number generator if you need a reproducible set of "random" numbers from a particular seed.

Posted: Mon Feb 27, 2006 5:30 pm
by Patz QuickBASIC Creations
Hmmmmm... A psuedo-RNG would work nice... In response to RyanKelly, I only need this to keep me off my computer. (I got bad grades and now i want to force myself off the computer) If I can make a false-RNG then that would work nicely. Thanks for the suggestions...