Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:43:54+00:00 2026-06-04T07:43:54+00:00

I certainly can’t use the random generator for that. Currently I’m creating a CRC32

  • 0

I certainly can’t use the random generator for that. Currently I’m creating a CRC32 hash from unixtime()+microtime().

Are there any smarter methods than hashing time()+microtime() ?

I am not fully satisfied from the results though, I expected it to be more random, but I can see strong patterns in it, until I added more calls to MicroTime() but it gets a lot slower, so I’m looking for some optimal way of doing this.

This silly code generates the best output I could make so far, the calculations were necessary or I could see some patterns in the output:

starthash(crc32);
    addtohash(crc32, MicroTime());
    addtohash(crc32, time(NULL)); // 64bit
    addtohash(crc32, MicroTime()/13.37f);
    addtohash(crc32, (10.0f-MicroTime())*1337.0f);
    addtohash(crc32, (11130.0f-MicroTime())/1313137.0f);
endhash(crc32);

MicroTime() returns microseconds elapsed from program start. I have overloaded the addtohash() to every possible type.

I would rather take non-library solutions, it’s just ~10 lines of code probably anyways, I don’t want to install huge library because of something I don’t actually need that much, and I’m more interested in the code than just using it from a function call.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:43:54+00:00Added an answer on June 4, 2026 at 7:43 am

    If in any doubt, get your seed from CryptGenRandom on Windows, or by reading from dev/random or dev/urandom on *NIX systems.

    This might be overkill for your purposes, but unless it causes performance problems there’s no point messing with low-entropy sources like the time.

    It’s unlikely to be underkill. And if you’re writing code with a real need for high-quality secure random data, and didn’t bother mentioning that in the question, well, you get what you deserve 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We can certainly do it by string.chomp+\r\n but I'm wondering is there an elegant
How can I use JUnit idiomatically to test that some code throws an exception?
Is there a framework that can be used to enable a C# Windows Service
Is there a way which I can return more information to the caller that
This can certainly be done using a simple script and reading the database. I
My problem is certainly right on my face but I can't see it... I
I am trying to write a detector that checks if a certain directory can
I've written a small console application that can perform certain tasks. The user interface
How can I remove certain font size options from the font size selector in
Can I have certain settings that are universal for all my users?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.