Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Objective is to create a random encoded string. But I'm not a computer science major, any explanation in layman terms would be much appreciated.
irb(main):002:0> SecureRandom.base64
=> "9VpzpvCR4ww/ZQc9lN148A=="
irb(main):003:0> SecureRandom.hex
=> "29b6cd61ec3e58959b006b6d98550b97"
The difference between Base64 and hex is really just how bytes are represented. Hex is another way of saying "Base16". Hex will take two characters for each byte - Base64 takes 4 characters for every 3 bytes, so it's more efficient than hex. ... If it does matter, then clearly Base64 is better on that front.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
lets suppose
al=['Al','2l','3l','4l','5l','6l','7l','8l','9l','jl','ql','kl']
af=['Af','2f','3f','4f','5f','6f','7f','8f','9f','jf','qf','kf']
ak=['Ak','2k','3k','4k','5k','6k','7k','8k','9k','jk','qk','kk']
an=['An','2n','3n','4n','5n','6n','7n','8n','9n','jn','qn','kn']
are array
let's suppose
there a two-person wait for random numbers to get
but they should not get the same word ( 3 outputs should be to 2 people from 4 arrays without repeating
)
Use Array#sample and then Enumerable#each_slice:
persons, cards = 2, 3
(al + af + ak + an).sample(persons * cards).each_slice(cards).to_a
#⇒ [["qk", "4l", "Ak"], ["6l", "8l", "5l"]]
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
How I can get always round number from Ruby rand method between the interval rand(1..99999999).
For Example I want to get as a result for example 1000 or 100000
Randomize the power of 10:
10 ** rand(1..9)
Why not this:
('1' + '0' * (0..10).sample).to_i
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
develop an ASM program to get the sum of integers 1 to 10 in R16..
hope someone can help total newbie
since the task does not require to actual calculate the sum the answer may be pretty easy:
LDI R16, 55
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Using only five 3s and valid mathematical operations, how to get answer 31? Only digit 3 should be there and you can use 5 times (no more or less) to get the answer.
Would this work?
33 - 3 + 3/3
You can get to 31 with…
(3**3+(3/3))+3