• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

generation of random numbers without using Random

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any way random numbers can be generated without using the Random
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bhayajis Bhayajis:
is there any way random numbers can be generated without using the Random


I don't suppose you are using Linux so you could just read from /dev/random?
You can do it mathematically, but pretty much any algorithm you'd come up with would either be (a) convergent (i.e. not very random) or (b) a re-implementation of java.math.Random. Basically you take a seed number (i.e. System.currentTimeMillis()) and use some function to generate a number. This is the first number in your series. You take that number and feed it back into your function to get the second random number in your series. Take the second number and feed it back in to get your third number and so on. The trick is to find a good function that evenly distributes the random numbers along the range you need without devolving into a predictable pattern and PROVING that behavior. I don't have my descrete mathematics textbook with me, so I can't come up with a good function offhand. Try googling for the subject. It sounds like a simple task but it is very complex.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bhayajis Bhayajis:
is there any way random numbers can be generated without using the Random


Why don't you want to use Random?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just read in Wired about a web service you can call to get random numbers. They sample noise from a webcam with the lens cap on. They used to sample from an array of lava lamps. No kidding!
Hey, I just looked at The Site - you can dl the software and get a cheap webcam and generate your own at up to 200,000 bits per second. Neat.
[ October 07, 2003: Message edited by: Stan James ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More inspired ideas for generating Random numbers.
or
Thomas Paul's Challenge: Optimum way to randomize 1,000,000 numbers
[ October 07, 2003: Message edited by: Cindy Glass ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic