QISKit.js algorithms
Please visit the main repository of the project to know about the rest of the tools.
Install
npm i @qiskit/algos
Use
const algos = require('@qiskit/algos');
console.log('Version');
console.log(algos.version);
const token = 'YOUR_LONG_TERM_TOKEN';
const userId = 'YOUR_USER_ID';
// With the default backend and length.
const jobId = await algos.random(token, userId)
console.log(`JobId: ${jobId}`)
// ... later
console.log(await algos.result(token, userId, jobId))
API
version
The actual version of the library.
-
version
(string) - Version number.
async random(token, userId, opts) -> jobId
Generate a true random number among 0 and 1.
-
token
(string) - QX long term access token (provided by thelogin
method of the qisqit-cloud package). -
userId
(string) - User identifier, same that for the last option. -
opts
(object) - Optional parameters:-
backend
(string) - Where to run the operation. Supported: "simulator", "ibmqx2", "ibmqx4", "ibmqx5", "qs1_1". (default: "simulator") -
length
(number) - Number of random hex characters to ask for, used as entropy. (default: 16)
-
-
jobId
(string) - Identifier for the generated background job (see next method).
async result(token, userId, jobId) -> result
Get the result of a background job generated by an algorithm method.
token
userId
-
jobId
(string) - Job identifier got as initial response. -
result
(?) - Depending on the used agorithm:- "random": (object) - With nex fields:
-
status
(string) - To know if the job has finished correctly. Supported: "running", "completed", TODO. -
data
(number) - Generated random number. Only present if "status" is "completed".
-
- "random": (object) - With nex fields: