Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming > Programming Theory

Programming Theory Discuss programming theory, algorithm efficiency, logic, and other any other category where math and computer science overlap.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 07-21-2008, 04:05 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,897
Last Blog:
Web slideshow in JavaS...
Rep Power: 78
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: Random.. not actually random

How about the current time, but just the millisecond part of it? I usually use DateTime.Now.Millisecond in .NET, which is the number of milliseconds in the current time.
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-21-2008, 04:18 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default Re: Random.. not actually random

Would it be possible to take more than one seed, combine them and make a more 'unique' and 'random' output?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 07-21-2008, 04:55 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 83
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Random.. not actually random

Yes of course it is possible. Just write your own algorithm that can take multiple seeds run them through an algorithm then produce a seed to actually be use.

About polymorphism...

A polymorphic code is basically a code that can change itself or mutate itself but still accomplish the same thing. Basically it can patch itself, move parts of its code around, do things in different orders, rename things, etc.

A random number is necessary to decide in which way the algorithm should change itself. So a polymorphic code will use different types of seeds to help ensure its randomness.

Here are some links on polymorphism...

Polymorphic code - Wikipedia, the free encyclopedia

Polymorphism

Check those out they'll explain it better...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 07-21-2008, 05:39 PM
marwex89's Avatar   
marwex89 marwex89 is offline
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,995
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Random.. not actually random

And one could always use a random number as a seed too
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 07-21-2008, 05:43 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 83
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Random.. not actually random

How do you get that random number to begin with unless you have a seed?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #16 (permalink)  
Old 07-21-2008, 05:46 PM
marwex89's Avatar   
marwex89 marwex89 is offline
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,995
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Random.. not actually random

What kind of question is that? You use another random number of course
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 07-21-2008, 05:54 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 83
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Random.. not actually random

LOL, yeah you can't really say that you will use a random number as a seed. Because you have to have a seed to get that random number, and if you use a random number for that seed you'll need another for that seed, etc.

Your best bet is just finding something that varies quite often either between systems, or is just changing constantly. This will of course depend on the type of program that it is.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 07-21-2008, 05:57 PM
marwex89's Avatar   
marwex89 marwex89 is offline
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,995
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Random.. not actually random

But it might work if you use different random generators, or would it?
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #19 (permalink)  
Old 07-21-2008, 06:11 PM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 83
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: Random.. not actually random

What do you mean by different random generators? You mean algorithms? And even so you are going to need different seeds otherwise your algorithms will end up always producing the same thing.

For example, let's say that you were using time as your seed and your first algorithm will start one second past midnight.

Algo 1) Takes the Seed of 1 and produces 5 (Multiplies by 5)
Algo 2) Takes the return of Algo 1 as a seed, 5, and produces 25 (Squares the Value)
Algo 3) Takes the return of Algo 2 as a seed, 25, and produces 18 (Subtracts 7)
Algo 4) Takes the return of Algo 3, as a seed, 18, and produces 9 (Divides by 2)

Okay do you finally end up with 2.

Now you might be saying okay that is more random because it went through more algorithms, but it's not because each algorithm depended on the first seed which is always going to be dependent on time. So basically everytime that it is one second past midnight you are going to get 2, just as if you had used the regular random function the value will always be the same.

That being said, you are best off finding a good seed. And if that is not good enough writing your own algorithm that can produce psuedo-random integers. But using multiple algorithms is pointless because they depend on eachother. Which will all lead back to the original seed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #20 (permalink)  
Old 07-21-2008, 06:19 PM
marwex89's Avatar   
marwex89 marwex89 is offline
Guru
 
Join Date: Jul 2008
Location: Viking-land!
Posts: 3,995
Rep Power: 30
marwex89 is a jewel in the roughmarwex89 is a jewel in the roughmarwex89 is a jewel in the rough
Send a message via AIM to marwex89
Default Re: Random.. not actually random

Yeah, you're right when one's thinking about it.. Man, it's late (yawn)
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
filling an array with random #s gaylo565 C# Programming 5 05-02-2008 12:21 PM
Encryption using Random!? TcM Programming Theory 14 01-07-2008 11:48 AM
Generating Random Numbers with PHP Paradine PHP Tutorials 4 08-27-2007 08:09 PM
Return random numbers without duplicates Paradine PHP Tutorials 0 08-26-2007 03:07 PM
Code:PHP Random Functions John PHP Tutorials 2 12-03-2006 11:04 AM


All times are GMT -5. The time now is 09:02 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads