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 176633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:54:44+00:00 2026-05-11T13:54:44+00:00

I am randomly generating a grid of characters and storing it in a char[,]

  • 0

I am randomly generating a grid of characters and storing it in a char[,] array …

I need a way to ensure that i haven’t already generated a grid before serializing it to a database in binary format…what is the best way to compare two grids based on bytes? The last thing i want to do is loop through their contents as I am already pulling one of them from the db in byte form.

I was thinking checksum but not so sure if this would work.

char[,] grid = new char[8,8]; char[,] secondgrid = new char[8,8];//gets its data from db 
  • 1 1 Answer
  • 2 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. 2026-05-11T13:54:44+00:00Added an answer on May 11, 2026 at 1:54 pm

    From what I can see, you are going to have to loop over the contents (or at least, a portion of it); there is no other way of talking about an arrays contents.

    Well, as a fast ‘definitely not the same’ you could compute a hash over the array – i.e. something like:

        int hash = 7;     foreach (char c in data) {         hash = (hash * 17) + c.GetHashCode();     } 

    This has the risk of some false positives (reporting a dup when it is unique), but is otherwise quite cheap. Any use? You could store the hash alongside the data in the database to allow fast checks – but if you do that you should pick your own hash algorithm for char (since it isn’t guaranteed to stay the same) – perhaps just convert to an int, for example – or to re-use the existing implementation:

        int hash = 7;     foreach (char c in data) {         hash = (hash * 17) + (c | (c << 0x10));     } 

    As an aside – for 8×8, you could always just think in terms of a 64 character string, and just check ==. This would work equally well at the database and application.

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

Sidebar

Related Questions

I am doing a small app that involves the system randomly generating objects. Here's
HI i'm stock with generating a random number I have an array that holds
I have an issue that I can't seem to solve. I am randomly generating
I'm generating some charts that need a hex string for the colors. Example: <dataseries
ok...so i'm randomly generating a level in a class and then pass it to
I have a randomly generated vector, say A of length M . Say: A
So I have the following code with works great for randomly generating position for
I have a wcf service that randomly begins to fail, when requesting the autogenerated
I am developing website and I am doing my best to ensure that I
Playing around with generating text randomly with each page refresh using php. Is there

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.