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

  • Home
  • SEARCH
  • 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 1008877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:50:19+00:00 2026-05-16T08:50:19+00:00

How do you generate UUID of type long (64 bits – to be consumed

  • 0

How do you generate UUID of type long (64 bits – to be consumed by a java program) using Python?

I read about the UUID module. So I played with it a bit:

>>> import uuid
>>> uuid.uuid1().int
315596929882403038588122750660996915734L

Why is there an “L” at the end of the integer generated by uuid.uuid1().int? If it’s an integer shouldn’t it be made up of pure numbers?

Also according to the documentation uuid.uuid1().int will generate a 128 bits integer. I need an integer of type long (for a java program), that would mean it need to be 64 bits. Is it possible to generate a UUID of 64 bits instead of 128 bits?

Another problem is that according to the Python doc a Python int is 32 bits while a Python long has “unlimited precision.” What does “unlimited precision” mean? I need a 64 bits long int – what Python type would that be?

EDIT:
Thanks for everyone’s replies. Looks like UUID’s are by definition 128 bits. In that case I probably shouldn’t be using the term UUID. What I want to do is to generate a unique ID that is of type long (64 bits). I thought UUID would do the job, but it looks like it can’t.

I need that ID as the document ID for Solr search engine. I’m using a real-time indexing Solr plugin Zoie. And according to the documentation, “Zoie assumes every record to be indexed must have a unique key and of type long.“

So given that’s what I need, do you know what I can do to generate unique ID of type long?

Thank you!

  • 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-05-16T08:50:20+00:00Added an answer on May 16, 2026 at 8:50 am

    Depending on how unique you need it to be, you may be able to generate your own form of UUID that is more of a machine wide unique ID rather than a universally unique ID (i.e. it may not be unique across computers but on the one computer is okay).

    If the ID need only be unique on the one platform then you can get away with removing the node id section at the end (the last 6 bytes).

    Also, you might consider how often these numbers are being generated. Are they generated once per second max or very frequently? Have a look here at how a UUID is generated and you’ll see what I mean: http://tools.ietf.org/id/draft-leach-uuids-guids-01.txt

    You can probably roll your own version for your situation and yet still meet your requirement and fit within 64 bits easily.

    By the way, the “L” symbolizes a long int which usually means 64-bit length, rather than 32-bit. It’s just appended when you print out the number.

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

Sidebar

Related Questions

No related questions found

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.