473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

generate random 64 bit client id integer

41
Hi

How can i create a random client id which is 64 bit integer as described on this below link

https://developers.google.com/analytics/devguides/collection/protocol/v1/email#client-id-cid

thanks

Vineet
Jun 1 '15 #1
1 1675
computerfox
276 100+
The documentation describes a number of two sets of ten separated by a period.

I could give you the answer, but I think you should give it a try.
For the time being, here's something in Python:

Expand|Select|Wrap|Line Numbers
  1. #!/bin/python
  2. import random
  3.  
  4. class generator:
  5.  id=None;
  6.  
  7.  def __init__(self):
  8.   self.id=self.gen();
  9.  
  10.  def gen(self):
  11.   chars_raw="1,2,3,4,5,6,7,8,9,0";
  12.   chars=chars_raw.split(",");
  13.   final="";
  14.   i=0;
  15.   while i < 2:
  16.    j=0;
  17.    while j < 10:
  18.     rand_index=random.randint(0,len(chars)-1);
  19.     final=final+chars[rand_index];
  20.     j+=1;
  21.    if i==0:
  22.     final=final+".";
  23.    i+=1;
  24.   return final;
  25.  
  26. session=generator();
  27. print session.id;
  28.  
http://cp.abelgancsos.com/project.php?id=403
Jun 2 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Yudan YI \(OSU\) | last post by:
I want to generate random data from a normal distribution, while I checked the functions, and I found rand(), which returns a pseudorandom integer between zero and RAND_MAX. I am not sure how to...
4
by: Marc Dansereau | last post by:
Hi all, I wonder what is the most efficient way to generate random point on a line defined by 2 double points (x0,y0) and (x1,y1). Here is the pseudocode of my method : for each point {...
7
by: MattB | last post by:
I have the following code to generate random passwords for new users of an application. Const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstyvwxyz1234567890" Dim r As Int16, i As...
6
by: comp.lang.php | last post by:
/** * Generate the random security image * * @access public * @param $willUseFilePath (default false) boolean to determine if you will be using a file path * @param mixed $filePath (optional)...
0
sashi
by: sashi | last post by:
Generate Random Password In the course of programming you may have cause to generate a password. The following function will generate a password of randomly selected characters up to a maximum of...
3
by: jjmontreal | last post by:
I would like to create a form where by clicking some where in the form it will generate a alphanumeric sequence. I want to generate random PIN numbers preceeded with specific letters. An example...
9
by: Chelong | last post by:
Hi All I am using the srand function generate random numbers.Here is the problem. for example: #include<iostream> #include <time.h> int main() {
24
by: pereges | last post by:
I need to generate two uniform random numbers between 0 and 1 in C ? How to do it ? I looked into rand function where you need to #define RAND_MAX as 1 but will this rand function give me ...
1
Srijith B
by: Srijith B | last post by:
HI all I am trying to write a perl script to generate random names ed. ( Qrhfh, Jdfhdh, Dfkjns) etc. So the script should ask me the number of random names and when I give say 4, It should give...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.