Re: Random Password

new topic     » goto parent     » topic index » view thread      » older message » newer message

Alex Blanchette wrote:
> 
> 
> I'm trying to write a simple DOS program that makes a random 6 number password
> when you press enter, but for somereason it won't start when I press enter,
> it just starts on its own and doesn't stop, is there a way I can fix this?
> How do I get it to print six random numbers on one line if I can only use
> one %d command in a puts() command?
> 
> (I just started programming about 4 days ago)
> 

Hi,
This what i use to make "random" password.
-- shuffl.e
global function shuffle(sequence s)
-- randomly shuffle the elements of a sequence
-- written by Gabriel Boehme
--    based Jiri Babor's Euphoria interpretation of the "uniformly random"
--    1963 shuffle algorithm written by L.E. Moses and R.V. Oakford
integer r
object temp
   for i = length(s) to 2 by -1 do
      r = rand(i)
      temp = s[r]
      s[r] = s[i]
      s[i] = temp
   end for
   return s
end function
-- 
-- mycode 
-- random.exw
include shuffl.e

sequence str, word
str = "0123456789ABCDEFGHIJKLMNOOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

word = {}
for n=1  to 10  do
    word &= str[rand(length(str))]
end for

puts(1, word)
?getc(0)
-- 


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu