473,549 Members | 2,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

generate random 64 bit client id integer

41 New Member
Hi

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

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

thanks

Vineet
Jun 1 '15 #1
1 1690
computerfox
276 Contributor
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
16564
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 use this function to generate my random data from a normal distribution. Thanks Yudan
4
5883
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 { dx=x1-x0 dy=y1-y1
7
2103
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 Int16 Dim Pswd As String = "" For i = 1 To len
6
3063
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) file path to store image resource object contents * @see actual_path */
0
8642
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 10 characters (this is easy to increase). The number of characters required is passed as a parameter. Using this type of procedure as opposed to...
3
5483
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 would be BW6666 or BW1234. Can anyone help?
9
6586
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
7187
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 uniformly distributed and unique numbers ?
1
4711
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 me four random names and then it should insert these names into the sql database to a table which is already created. Here is my code. ...
0
7446
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7808
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.