Generate a random value in the set {0,1} - pentaho

Actually the Generate random value input allows me to generate an random int, but not in the set I want.
How to generate a random value in the set {0,1} with Pentaho Data Integration ?

You can generate a random number in the range of [0..1] with
http://wiki.pentaho.com/display/EAI/Generate+Random+Value
and then just round it to an integer of your set {0,1} via ROUND()
http://wiki.pentaho.com/display/EAI/Calculator

Related

The set of atomic irrational numbers used to express the character table and corresponding (unitary) representations

I want to calculate the irrational number, expressed by the following formula in gap:
3^(1/7). I've read through the related description here, but still can't figure out the trick. Will numbers like this appear in the computation of the character table and corresponding (unitary) representations?
P.S. Basically, I want to figure out the following question: For the computation of the character table and corresponding (unitary) representations, what is the minimum complete set of atomic irrational numbers used to express the results?
Regards,
HZ
You can't do that with GAP's standard cyclotomic numbers, as seventh roots of 3 are not cyclotomic. Indeed, suppose $r$ is such a root, i.e. a rot of the polynomial $f = x^7-3 \in \mathbb{Q}[x]$. Then $r$ is cyclotomic if and only if the field extension \mathbb{Q}[x] is a subfield of a cyclotomic field. By Kronecker-Weber this is equivalent to that field being an abelian extension, i.e., the Galois group is abelian. One can check that this is not the case here (the Galois group is a semidirect product of C_7 with C_6).
So, $r$ is not cyclotomic.

How to use a Random Expression again in Tosca?

I am working on Tosca tool and I want to know, How to reuse an random expression value again in another step but in the same test case?
Example: I have given a random expression for mail I'd and I would like to use that randomly generated mail again
You could create and buffer the random expression and use the buffer value at any point in your testcase

Visual Basic - How to check how many times a number goes into another

I need to check how many sixes can fit into a number entered by the user to be able to use it in my program later on. So for example, two sixes can fit into 13. I was wondering if there's an algorithm I can use for this.
You want to do an integer division. See the MSDN page about arithmetic operators or the MSDN page about the \ Operator:
Dim k As Integer
k = 23 \ 5
' The preceding statement sets k to 4.
if you need that, simply divide one by the other and change to integer:
https://msdn.microsoft.com/en-us/library/se0w9esz.aspx says
number1 \ number2
returns the value you desire for VB, I presume it carries over to VBA.
Otherwise, you can use
CInt(Fix(number1/number2))
(from https://msdn.microsoft.com/en-us/library/xh29swte(v=vs.90).aspx)

Fuzzing tool: Mutate integer within predefined range?

I am newbie to fuzzing tools, and basically, I would like to use fuzzing tool to test a specific function.
Essentially, this function has three input parameter, and each parameter is a number, with range 0 to 0xffff.
I would like to use a fuzzing tool to generate random input combinations, and test the target function. However, I tried zzuf, but find that it does not have a specific setting on mutating integer value..
So I am looking for a fuzzer, that supports to only mutate integer value, within a predefined range? Could anyone give me some help on this issue? Am I clear enough? Thank you.
This can be done with many tools, among them Kitty (developed by my team).
Assuming you want to generate the number with decimal representation, the following template will generate them for you (values will be comma-separated):
from kitty.model import *
t = Template(name='function inputs', fields=[
S32(name='p1', value=1, min_value=-500, max_value=1000, encoder=ENC_INT_DEC),
Static(','),
ForEach(name='p2', mutated_field='p1',
fields=S32(value=2, min_value=-3200, max_value=5098, encoder=ENC_INT_DEC)),
Static(','),
ForEach(name='p3', mutated_field='p2',
fields=S32(value=3, min_value=0, max_value=999, encoder=ENC_INT_DEC))
])
while t.mutate():
print t.render().tobytes()
Some example results:
-1,2,3
129,1026,3
129,130,3
129,18,3
129,-3200,3
129,5098,3
129,-3199,3
129,5097,3
129,-3198,3
129,5096,3
129,3,3
129,1,3
129,4,3
129,0,3
17,1026,3
17,130,3
17,18,3
17,-3200,3
17,5098,3
17,-3199,3

Convert an alphanumeric string to integer format

I need to store an alphanumeric string in an integer column on one of my models.
I have tried:
#result.each do |i|
hex_id = []
i["id"].split(//).each{|c| hex_id.push(c.hex)}
hex_id = hex_id.join
...
Model.create(:origin_id => hex_id)
...
end
When I run this in the console using puts hex_id in place of the create line, it returns the correct values, however the above code results in the origin_id being set to "2147483647" for every instance. An example string input is "t6gnk3pp86gg4sboh5oin5vr40" so that doesn't make any sense to me.
Can anyone tell me what is going wrong here or suggest a better way to store a string like the aforementioned example as a unique integer?
Thanks.
Answering by request form OP
It seems that the hex_id.join operation does not concatenate strings in this case but instead sums or performs binary complement of the hex values. The issue could also be that hex_id is an array of hex-es rather than a string, or char array. Nevertheless, what seems to happen is reaching the maximum positive value for the integer type 2147483647. Still, I was unable to find any documented effects on array.join applied on a hex array, it appears it is not concatenation of the elements.
On the other hand, the desired result 060003008600401100500050040 is too large to be recorded as an integer either. A better approach would be to keep it as a string, or use different algorithm for producing a number form the original string. Perhaps aggregating the hex values by an arithmetic operation will do better than join ?