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

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 »

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 »

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 »

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

Ok, im on linux too
:lol:
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post 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]
RyanKelly
Coder
Posts: 48
Joined: Sun Jan 22, 2006 6:40 pm
Contact:

Post 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.
DrV
Veteran
Posts: 63
Joined: Thu Jun 02, 2005 9:44 pm

Post 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.
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

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