windows linux compatability

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

windows linux compatability

Post by Patz QuickBASIC Creations » Tue Feb 21, 2006 8:49 pm

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)

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Tue Feb 21, 2006 9:23 pm

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 ;-).
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

FreeBasic

Post by Zim » Wed Feb 22, 2006 12:39 pm

Code:

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

Here's the output:

0.778656005859375
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Re: windows linux compatability

Post by bungytheworm » Wed Feb 22, 2006 4:15 pm

Patz QuickBASIC Creations wrote: (i am looking for an output of 0.3176822056993842)
0.317682205699384

Ok, im on linux too
:lol:

User avatar
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations » Wed Feb 22, 2006 4:41 pm

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]

RyanKelly
Coder
Posts: 48
Joined: Sun Jan 22, 2006 6:40 pm
Contact:

Post by RyanKelly » Wed Feb 22, 2006 10:41 pm

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.

DrV
Veteran
Posts: 63
Joined: Thu Jun 02, 2005 9:44 pm

Post by DrV » Fri Feb 24, 2006 10:36 pm

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.

User avatar
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations » Mon Feb 27, 2006 5:30 pm

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...

Post Reply